www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7406] New: tuple foreach doesn't work with mixed tuples

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



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: -------
Jan 30 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7406


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch, rejects-valid



https://github.com/D-Programming-Language/dmd/pull/667

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 31 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7406




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/992fe402c66b554253ecc8c624a336f6e372e017


Issue 7406 - tuple foreach doesn't work with mixed tuples

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 17 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7406




Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/14e3bb9c533c178478c7b8a002b8dc05d58f722f
fix Issue 7406 - tuple foreach doesn't work with mixed tuples

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 17 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7406


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2012