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"); }
Fixed DMD2.030 and 1.045. This works now. Test case was wrong, though, should have been: -- template Templ(T) { const char[] x = (Type).stringof; alias T Type; } void main() { static assert(Templ!(int).x =="int"); }