Summary: Forward reference of .stringof in a template gives wrong
           Product: D
           Version: 1.042
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD

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");


Reply via email to