https://issues.dlang.org/show_bug.cgi?id=21285
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #5 from [email protected] --- The problem has not been completely fixed. Just a slight refactoring and it fails again: Code: -------- int f(string s) { throw new Exception(""); } void main() { string path; int bank, preset; void delegate(string value)[string] aa = [ "path": (string arg) { path = arg; }, "bank": (string arg) { bank = f(arg); }, "preset": (string arg) { preset = f(arg); }, ]; } -------- Compiler output: -------- test.d(7): Error: cannot implicitly convert expression __lambda1 of type void delegate(string arg) pure nothrow @nogc @safe to void delegate(string arg) @system -------- Oddly enough, replacing the `preset` line with `preset = 1;` makes the problem go away. Somehow the number of elements in the AA initializer changes compiler behaviour. Expected behaviour: `pure nothrow @nogc @safe` ought to be covariant with `@system`. And this covariance should not vary with unrelated factors such as the number of elements in the AA initializer. --
