http://d.puremagic.com/issues/show_bug.cgi?id=7815
Summary: Mixin template forward reference (?) regression Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: c...@klickverbot.at --- Comment #0 from klickverbot <c...@klickverbot.at> 2012-04-03 10:08:27 PDT --- DMD 2.058 accepted the following snippet, while DMD c2824d43 executes the else branch of the static if. In there, though, instantiating the template will (apparently) just work fine. --- mixin template Helpers() { alias typeof(this) This; static if (is(Flags!This)) { Flags!This flags; } else { // DMD will happily instantiate the allegedly // non-existent Flags!This here. (!) pragma(msg, __traits(derivedMembers, Flags!This)); } } template Flags(T) { mixin({ string defs; foreach (name; __traits(derivedMembers, T)) { defs ~= "bool " ~ name ~ ";\n"; } if (defs.length > 0) { return "struct Flags {" ~ defs ~ "}"; } else { return ""; } }()); } struct Move { int a; mixin Helpers!(); } enum a = Move.init.flags; // isSetFlags should exist. --- (Note that while the above code is probably not the minimal possible example needed to trigger the bug, it has been reduced beyond repair as far as its original intent goes, so don't try to make sense of it in that regard.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------