[Issue 13941] New: NewExpression grammar is insufficient
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jan 5 14:19:01 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13941
Issue ID: 13941
Summary: NewExpression grammar is insufficient
Product: D
Version: D2
Hardware: All
URL: http://dlang.org/grammar.html#NewExpressionWithArgs
OS: All
Status: NEW
Keywords: spec
Severity: normal
Priority: P1
Component: websites
Assignee: nobody at puremagic.com
Reporter: briancschott at gmail.com
Blocks: 10233
Consider the following reasonable D program:
---
void main()
{
import std.stdio : writeln;
int[][] var = new int[][](3, 2);
writeln(var);
}
---
The relevant parts of the grammar:
NewExpressionWithArgs:
'new' AllocatorArguments? Type '(' ArgumentListopt ')'
Type:
TypeCtors? BasicType
TypeCtors? BasicType AltDeclarator
AltDeclarator:
BasicType2? Identifier AltDeclaratorSuffixes
AltDeclaratorSuffix:
'[' ']'
"int[][]" cannot be parsed with the AltDeclarator rule because there is no
identifier between "int" and "[][]"
--
More information about the Digitalmars-d-bugs
mailing list