[Issue 10803] pragma(msg, ...) fails with enum TypeTuple: compilation error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 12 08:53:06 PDT 2013


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



--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2013-08-12 08:53:04 PDT ---
(In reply to comment #3)
> Proof-link to the docs? And what is exact meaning of it (what is type of of
> enum)?

D has "tuple of variables", and today it is accepted in statement scope and
aggregate fields.

import std.typetuple;

void test1()
{
    auto tup1 = TypeTuple!(1, "a");
    pragma(msg, typeof(tup1));  // (int, string)
    assert(tup1[0] == 1);
    assert(tup1[1] == "a");
    tup1[0] = 2;
    tup1[1] = "b";
    assert(tup1[0] == 2);
    assert(tup1[1] == "b");

    enum tup2 = TypeTuple!(1, "a");
    pragma(msg, typeof(tup2));  // (int, string)
    assert(tup2[0] == 1);
    assert(tup2[1] == "a");
}

struct Tuple(TL...)
{
    TL tup3;
}
alias ConcreteTuple = Tuple!(int, string);

// BUG: should be accepted as same as tup1 to 3
//auto tup4 = TypeTuple!(1, "a");
//enum tup5 = TypeTuple!(1, "a");

I think that should also be accepted in module scope.


If this is legal, why this:
> 
> auto foo()
> {
>     return TypeTuple!("aaa", "bbb");
> } 
> 
> is not?

That's completely irrelevant thing. D's built-in tuple is not packed, and D ABI
does not support "multiple value return from function".

-- 
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