[Issue 9901] New: string return from inner template function error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 7 15:31:42 PDT 2013


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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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: -------


More information about the Digitalmars-d-bugs mailing list