digitalmars.D.bugs - [Issue 7805] New: "static" allows free templated functions to accept struct fields as template alias parameters
- d-bugmail puremagic.com (35/35) Mar 31 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7805
http://d.puremagic.com/issues/show_bug.cgi?id=7805 Summary: "static" allows free templated functions to accept struct fields as template alias parameters Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: thecybershadow gmail.com --- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2012-03-31 07:20:50 PDT --- //static string f(alias X)() { return null; } struct S { int i; mixin(f!i()); } This program doesn't compile, however uncommenting "static" makes it work. DMD 2.058 produces this error message: test.d(8): Error: struct test.S no size yet for forward reference DMD git produces a different error message: test.d(2): Error: function test.S.f!(i).f need 'this' to access member f Note that fixing this issue by making both cases fail to compile would break code. I believe the Orange serialization library uses this trick to stringify field names with minimal syntax overhead. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 31 2012