Thread overview
[Issue 7804] New: Cannot alias __traits directly
Mar 31, 2012
simendsjo
Dec 10, 2012
Andrej Mitrovic
Feb 21, 2013
Andrej Mitrovic
May 02, 2013
Andrej Mitrovic
May 02, 2013
Andrej Mitrovic
March 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7804

           Summary: Cannot alias __traits directly
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: simendsjo@gmail.com


--- Comment #0 from simendsjo <simendsjo@gmail.com> 2012-03-31 06:03:57 PDT ---
/*
basic type expected, not __traits
no identifier for declarator int
semicolon expected to close alias declaration
Declaration expected, not '__traits'
*/
template f(T) {
    alias __traits(allMembers, T) f;
}

// ok
template g(T) {
    enum members = __traits(allMembers, T);
    alias members g;
}

Tested on 2.059 trunk.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7804


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-12-10 15:42:43 PST ---
*** Issue 5877 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7804


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-21 15:08:20 PST ---
This bug is extremely annoying in metaprogramming. I can't fix it, the parser in DMD is implemented in a bizarre way. Anyone know what it would take to make this work?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7804


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg@gmail.com


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-05-02 03:31:07 PDT ---
*** Issue 10014 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7804



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-05-02 03:31:49 PDT ---
Test-case from Issue 10014:

----
class C { int i; }
static assert(is(__traits(parent, C.i) == C)); // Error
----

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