-
-
Notifications
You must be signed in to change notification settings - Fork 380
Open
Description
The following expressions are accepted by DMD, but not allowed by the grammar:
const e1 = int*.init;
const e2 = int[1].init;
const e3 = int*[0].init;
The grammar for PrimaryExpression only allows '(' or '.' after FundamentalType:
PrimaryExpression:
...
FundamentalType . Identifier
...
FundamentalType ( NamedArgumentListopt )
...
I assume DMD allows these expressions since this PR: dlang/dmd#14672
The parser contains the comment "defer error for better diagnostics", so maybe the new syntax is not allowed intentionally.
The new syntax is used by a test in druntime: https://github.com/dlang/dmd/blob/fb07d990466f185c2adb19d320627c2723d3978a/druntime/src/core/internal/traits.d#L625
Metadata
Metadata
Assignees
Labels
No labels