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



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



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




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


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