[Issue 3950] New: Wrong error message in recursive template call with no !

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 13 04:51:49 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3950

           Summary: Wrong error message in recursive template call with no
                    !
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          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 2010-03-13 04:51:48 PST ---
This is wrong D2 code (there is a ToString(x % 10) with no bang):


template ToString(ulong x) {
    static if (x < 10)
        enum string ToString = "" ~ cast(char)(x + '0');
    else
        enum string ToString = ToString!(x / 10) ~
                               ToString(x % 10); // missing ! here
}
pragma(msg, ToString!(10));
void main() {}


The compiler gives a wrong error message:
test.d(8): Error: template instance bug3.ToString!(10) recursive expansion

-- 
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