Issue ID: 18601
           Summary: alias m = __traits(getMember, ...) doesn't work
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd

It's annoying that this doesn't work:

struct S
    int x;

void f()
    S s;
    alias m = __traits(getMember, s, "x");

> Error: basic type expected, not `__traits`
> Error: semicolon expected to close `alias` declaration

I'm pretty sure this could be trivially supported...?

I feel like that __traits statement should be semantically identical to:
   alias m = s.x;

The __traits(getMember) docs make you feel like that's true...


Reply via email to