[Issue 14977] New: Struct initializer doesn't work inside AA initializer
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Aug 29 05:56:29 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14977
Issue ID: 14977
Summary: Struct initializer doesn't work inside AA initializer
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: japplegame at gmail.com
struct Foo {
int a;
}
void main() {
// compiles
Foo[] arr = [
{a: 1},
{a: 2}
];
// compiles
Foo[int] aa1 = [
1: Foo(),
2: Foo()
];
// Error: not an associative array initializer
Foo[int] aa2 = [
1: {a: 1},
2: {a: 2}
];
}
--
More information about the Digitalmars-d-bugs
mailing list