[Issue 10014] New: `__traits(parent, ...)` isn't parsed as type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 30 07:13:50 PDT 2013


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

           Summary: `__traits(parent, ...)` isn't parsed as type
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-04-30 18:13:49 MSD ---
---
class C { int i; }

static assert(is(__traits(parent, C.i) == C)); // Error (line 3)

template Id(T){ alias Id = T; }
static assert(is(Id!(__traits(parent, C.i)) == C)); // OK
---

dmd output:
---
main.d(3): Error: basic type expected, not __traits
main.d(3): Error: found '__traits' when expecting ')'
main.d(3): Error: found ')' when expecting ';'
---

Workaround:
Use `Id` template.

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