[Issue 1670] tupleof an aggregate cannot be used as a template tuple argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 16 05:53:25 PST 2009


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


Michal Minich <michal.minich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michal.minich at gmail.com


--- Comment #1 from Michal Minich <michal.minich at gmail.com> 2009-11-16 05:53:24 PST ---
struct Point { int x; int y; }

void main ()
{
    Point p;

    mixin Foo!(p.x);               // works (prints "x" at compile time)

    mixin Foo!(Point.x);           // works (prints "x" at compile time)

    mixin Foo!(p.tupleof[0]);      // Error: expression (Point).x is not a
valid template value argument (but still prints "(Point).x" at compile time)

    mixin Foo!(Point.tupleof[0]);  // Error: expression (Point).x is not a
valid template value argument (but still prints "(Point).x" at compile time)
}

template Foo (alias a)
{
    pragma (msg, a.stringof);
}

Shouldn't p.x and p.tupleof[0] work the same way ?

tested on DMD 2.036

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