The rule for having a type like int, char, etc. as expression is, according to https://dlang.org/spec/expression.html#primary_expressions
```ebnf
FundamentalType "." Identifier
```
so the following code should not parse
```d
ubyte[] v()
{
ubyte[] buffer;
buffer ~= char; // here the rhs
return buffer;
}
enum ubyte a = v()[0];
```
but instead it does and ends up with a semantic-time error.
Comment #1 by nick — 2024-11-08T15:41:57Z
> instead it does and ends up with a semantic-time error
Is that a problem? That was intentional to fix issue 9848. Though that also meant things like this work:
alias T = int;
pragma(msg, int[T]);
Before dmd 2.102 that was a parse error.
Comment #2 by b2.temp — 2024-11-09T10:24:32Z
It's not a problem but the specs need to be updated.
Comment #3 by robert.schadek — 2024-12-13T19:31:36Z