www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1670] New: tupleof an aggregate cannot be used as a template tuple argument

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1670

           Summary: tupleof an aggregate cannot be used as a template tuple
                    argument
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jarrett.billingsley gmail.com


struct S
{
        int x;
}

class C
{
        int x;
}

union U
{
        int x;
}

alias Tuple!(S.tupleof) ST;
alias Tuple!(C.tupleof) CT;
alias Tuple!(U.tupleof) UT;

All of those instantiations give the error "Error: tuple is not a valid
template value argument".  No, but I'd suppose being tuples that they'd be
valid _tuple_ arguments, Mr. Compiler!


-- 
Nov 15 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1670


andrei metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei metalanguage.com
             Status|NEW                         |ASSIGNED




-- 
Feb 16 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1670


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

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



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: -------
Nov 16 2009