https://issues.dlang.org/show_bug.cgi?id=23375
Dennis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Dennis <[email protected]> --- I thought it would allocate a new array literal in f(), but it really modifies global state: ``` class C { string s; this(string a) pure @safe nothrow { s = a; } override string toString() {return s;} } enum C[] cs = [ new C("a"), new C("b") ]; void f() pure @safe @nogc nothrow { cs[0].s = "c"; } import std.writeln; void main() { writeln(cs); // [a, b] f(); writeln(cs); // [c, b] } ``` I think the could should be accepted without @nogc, and it would modify a copy of the array. --
