Re: Struct literals and AA literals

2016-05-24 Thread Lodovico Giaretta via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 06:59:18 UTC, Jacob Carlborg wrote: What we need is something like this [1]: auto c = Config{ foo: "foo", bar: "bar }; The compiler will know for sure that "c" is of type Config because the right side includes the type. [1]

Re: Struct literals and AA literals

2016-05-24 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-05-23 21:51, Lodovico Giaretta wrote: Hi, Today I stumbled upon this weird error: struct ConfigContainer { Config[string] configs; } struct Config { string foo; string bar; } enum ConfigContainer cc = { configs: [

Struct literals and AA literals

2016-05-23 Thread Lodovico Giaretta via Digitalmars-d-learn
Hi, Today I stumbled upon this weird error: struct ConfigContainer { Config[string] configs; } struct Config { string foo; string bar; } enum ConfigContainer cc = { configs: [// error: not an associative array