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.
> 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.
It's not a problem but the specs need to be updated.