[Issue 2861] New: Forward reference of .stringof in a template gives wrong value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 20 02:53:22 PDT 2009


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

           Summary: Forward reference of .stringof in a template gives wrong
                    value
           Product: D
           Version: 1.042
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au


If you reverse the order of the declaration of x and Type, it works correctly.
For D2, change declaration of x to:  enum x = Type.stringof;
This is very similar to bug 934. With my patch applied, the equivalent
situation for .mangleof works correctly.
----
template Templ(T) {
   const char[] x = Type.stringof;
   alias T Type;
}

void main() {
    static assert(Templ!(int).x =="int");
}


-- 



More information about the Digitalmars-d-bugs mailing list