The following code currently results in a syntax error:
```
struct TypeUDA(T)
{
alias Type = T;
}
enum E
{
@TypeUDA!short int16,
@TypeUDA!int int32,
@TypeUDA!long int64,
}
alias X = __traits(getAttributes, E.int32)[0].Type;
```
The error message is:
```
test.d(11): Error: semicolon expected to close `alias` declaration, not `.`
test.d(11): Error: no identifier for declarator `.Type`
```
Comment #1 by nick — 2024-10-13T09:15:15Z
I think the grammar doesn't support that yet:
https://dlang.org/spec/type.html#grammar
QualifiedIdentifier:
...
Identifier [ AssignExpression ] . QualifiedIdentifier
We would need:
TraitsExpression [ AssignExpression ] . QualifiedIdentifier
Comment #2 by tim.dlang — 2024-10-13T09:50:04Z
Yes, it looks like this grammar change would be needed.
The following also does not compile, so it is consistent:
```
__traits(getAttributes, E.int32)[0].Type x;
```
Alternatively the grammar for BasicType could get:
```
TraitsExpression . QualifiedIdentifier
```
This would be similar to Typeof.
The same problem also exists for mixins:
```
alias X1 = mixin("Types")[0].Type;
alias X2 = mixin("Types").Type;
```
It is not a high priority. It was just unexpected.
Comment #3 by robert.schadek — 2024-12-13T19:38:03Z