[Issue 18078] [CTFE] wrong initialization of array member with inout opIndex
https://issues.dlang.org/show_bug.cgi?id=18078 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --
[Issue 18078] [CTFE] wrong initialization of array member with inout opIndex
https://issues.dlang.org/show_bug.cgi?id=18078 ag0aep6g changed: What|Removed |Added Keywords||wrong-code CC||ag0ae...@gmail.com --
[Issue 18078] [CTFE] wrong initialization of array member with inout opIndex
https://issues.dlang.org/show_bug.cgi?id=18078 bitter.ta...@gmx.com changed: What|Removed |Added CC||bitter.ta...@gmx.com --- Comment #1 from bitter.ta...@gmx.com --- Reduced to: --- struct S { int x; version (problem) void opAssign(S o) { x = o.x; } } struct Foo { S[1] data; ref inout(S) g() inout { return data[0]; } this(S a) { g() = a; } } void main() { enum x = Foo(S(42)); assert(x.data[0].x == 42); } --- The problem disappears if you remove `opAssign` (or the inout qualifiers). --