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

--- Comment #0 from 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:
------- You are receiving this mail because: -------

Reply via email to