www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9901] New: string return from inner template function error

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9901

           Summary: string return from inner template function error
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-04-07 15:31:41 PDT ---
template isGood(T) {
    enum isGood = true;
}
void main() {
    string foo(R)(R data) if (isGood!R) {
        return "";
    }
    foo(1);
}



DMD 2.063alpha:

temp.d(5): Error: found 'foo' when expecting ';' following statement
temp.d(5): Error: found 'data' when expecting ')'
temp.d(5): Error: C style cast illegal, use cast(R)R
temp.d(5): Error: found ')' when expecting ';' following statement


While this very similar program compiles with no errors:


template isGood(T) {
    enum isGood = true;
}
void main() {
    immutable(char)[] foo(R)(R data) if (isGood!R) {
        return "";
    }
    foo(1);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 07 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9901


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-04-07 20:21:02 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1865

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 07 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9901



--- Comment #2 from github-bugzilla puremagic.com 2013-04-11 10:44:15 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ac4f2f4e42dc8404ae6a177944ea5183d2ba4a9c
fix Issue 9901 - string return from inner template function error

https://github.com/D-Programming-Language/dmd/commit/9432dd51cedc93cad54214974f810155e7648bea
Merge pull request #1865 from 9rnsr/fix9901

Issue 9901 - string return from inner template function error

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 11 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9901


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 11 2013