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: bugzi...@digitalmars.com ReportedBy: clugd...@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"); } --