Tested on Gnu/Linux, 64-bit, DMD-2.057 --------------------------8<----------------------------8<-------------------------------------- struct A(int r, int c){ public: alias r R; alias c C; alias float[R * C] Data; Data _data; alias _data this; this(Data ar){ _data = ar; } pure ref float opIndex(size_t rr, size_t cc){ return _data[cc + rr * C]; } } void main(){ A!(2, 2) a = A!(2, 2)([8, 3, 2, 9]); a[0,0] -= a[0,0] * 2.0; } -------------------------->8---------------------------->8-------------------------------------- workaround: avoid compound assignment operators.
https://github.com/D-Programming-Language/dmd/pull/695
Fixed D2: https://github.com/D-Programming-Language/dmd/commit/34cb3dec9de6c1c01850447c29fc2bc81d386382 Can't reproduce with D1.