May 16, 2020
https://issues.dlang.org/show_bug.cgi?id=20835

          Issue ID: 20835
           Summary: Enum member attributes being evaluated in wrong scope.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: jonathanilevi@gmail.com

Accessing enum member attributes, throwing an "undefined identifier" error (at CT), if the attributes of the member are not first accessed in the scope which the attribute is defined in.

This code exemplifies the error:
```
import std;

template T(E) {
    pragma(msg, __traits(getAttributes, E.a));
    enum T = null;
}

void main() {
    class C {}
    enum E {
        @C a
    }
    ////pragma(msg, __traits(getAttributes, E.a));
    pragma(msg, T!E);
}
```

Uncommenting the commented out line, makes the error not happen.

--