[Bug 39] New: ArrayMemberInitialization, StructMemberInitializer inconsistencies from dmd's behavior
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 12 10:58:56 PST 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=39
Summary: ArrayMemberInitialization, StructMemberInitializer
inconsistencies from dmd's behavior
Product: D
Version: 0.149
Platform: Macintosh
OS/Version: Mac OS X
Status: NEW
Severity: normal
Priority: P2
Component: www.digitalmars.com
AssignedTo: bugzilla at digitalmars.com
ReportedBy: braddr at puremagic.com
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
--
More information about the Digitalmars-d-bugs
mailing list