http://d.puremagic.com/issues/show_bug.cgi?id=7406
Summary: tuple foreach doesn't work with mixed tuples Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: d...@dawgfoto.de --- Comment #0 from d...@dawgfoto.de 2012-01-30 20:58:19 PST --- template TypeTuple(T...) { alias T TypeTuple; } template foobar(T) { enum foobar = 2; } void main() { foreach(sym; TypeTuple!(int, double)) // OK pragma(msg, sym.stringof); foreach(sym; TypeTuple!(foobar)) // OK pragma(msg, sym.stringof); foreach(sym; TypeTuple!(main)) // OK pragma(msg, sym.stringof); foreach(sym; TypeTuple!(int, foobar)) // Error: type int has no value pragma(msg, sym.stringof); foreach(sym; TypeTuple!(int, main)) // Error: type int has no value pragma(msg, sym.stringof); } ---- As soon as a symbol is part of the tuple it is treated as expression tuple. Foreach with an expression tuple then tries to use each tuple element as initializer which fails for types. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------