[Issue 24229] New: Parser accepts basic type as primary expression without dot identifier
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 5 19:46:02 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24229
Issue ID: 24229
Summary: Parser accepts basic type as primary expression
without dot identifier
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: accepts-invalid
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: b2.temp at gmx.com
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.
--
More information about the Digitalmars-d-bugs
mailing list