Bug 39 – ArrayMemberInitialization, StructMemberInitializer inconsistencies from dmd's behavior

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D1 (retired)
Platform
PowerPC
OS
Mac OS X
Creation time
2006-03-12T12:58:00Z
Last change time
2014-02-15T02:15:20Z
Keywords
spec
Assigned to
bugzilla
Creator
braddr
Blocks
677

Comments

Comment #0 by braddr — 2006-03-12T12:58:55Z
Currently, the spec describes ArrayMemberInitialization so: ArrayMemberInitialization: AssignExpression AssignExpression : AssignExpression However, considering the following: struct test { int i; } static test[] tests = [ {1}, ]; Compiles just fine, I believe the spec to be incorrect. Instead, it might be: ArrayMemberInitialization: AssignExpression AssignExpression : AssignExpression StructInitializer AssignExpression : StructInitializer ArrayInitializer AssignExpression : ArrayInitializer That said, this compiles too: struct test { int[] i; } static test tests = { [1, 2, 3] }; So it might seem that StructMemberInitializer would need the reverse change, becoming: StructMemberInitializer: AssignExpression Identifier : AssignExpression ArrayInitializer Identifier : ArrayInitializer StructInitializer Identifier : StructInitializer
Comment #1 by smjg — 2006-07-19T09:26:57Z
Indeed, ctod.html has an example of array initialisers nested within each other. So obviously, the documented ArrayMemberInitialization syntax is inaccurate. Moreover, why not make it a little simpler: ArrayMemberInitialization: Initializer AssignExpression : Initializer StructMemberInitialization: // let's make the naming consistent Initializer Identifier : Initializer
Comment #2 by bugzilla — 2006-12-27T01:57:30Z
Fixed DMD 0.178