[Issue 8422] New: TypeTuple of tuples can't be read at compile time

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 24 00:59:42 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8422

           Summary: TypeTuple of tuples can't be read at compile time
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-07-24 00:59:39 PDT ---
This program

import std.typecons;
import std.typetuple;

void main()
{
    enum a = tuple(0, 1);
    enum b = tuple(0, 2);
    foreach(t; TypeTuple!(a, b))
    {
        enum u = t;
    }
}

fails to compile, giving this error:

q.d(10): Error: variable t cannot be read at compile time
q.d(10): Error: variable t cannot be read at compile time

And this one

import std.typecons;
import std.typetuple;

void main()
{
    enum a = tuple(0, 1);
    enum b = tuple(0, 2);
    enum c = TypeTuple!(a, b);
    enum t = c[0];
}

fails with this error:

q.d(8): Error: variable _c_field_0 cannot be read at compile time

tuple works just fine at compile time. TypeTuple obviously works just fine at
compile time, since it's a compile time construct. But for some reason, a
TypeTuple of tuples doesn't work, which is really annoying when you need a
static foreach over a list of groups of values and you can't use a TypeTuple of
TypeTuples, since they'd flatten.

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


More information about the Digitalmars-d-bugs mailing list