Bug 13941 – NewExpression grammar is insufficient

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-05T22:19:00Z
Last change time
2015-01-18T06:28:25Z
Keywords
pull, spec
Assigned to
nobody
Creator
briancschott
Blocks
10233

Comments

Comment #0 by briancschott — 2015-01-05T22:19:01Z
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 "[][]"
Comment #1 by k.hara.pg — 2015-01-18T05:16:28Z
Comment #2 by github-bugzilla — 2015-01-18T06:28:24Z
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/5e9be8f673f3d8ca6486b6dda410ffb3f04eeede fix Issue 13941 - NewExpression grammar is insufficient - Fix `Type` rule by using `BasicType2` It should be consistent with parseType() in dmd code. - `BasicType2` should handle repetition It should be consistent with parseBasicType2() in dmd code. https://github.com/D-Programming-Language/dlang.org/commit/344436839db5acee6b4edcb602a5336aa2cc722a Merge pull request #781 from 9rnsr/fix13941 Issue 13941 - NewExpression grammar is insufficient