November 05, 2023 [Issue 24229] New: Parser accepts basic type as primary expression without dot identifier | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: b2.temp@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. -- |
Copyright © 1999-2021 by the D Language Foundation