Hi, This code works well with the unoptimized compilation with DMD.
import std.array; synchronized class Obj{ private int[] arr; void trigger(){ arr.length += 1; } } void main(){ auto k = new shared Obj; k.trigger; }And when I use the -O option, it shows the following error in the trigger() method:
core.exception.InvalidMemoryOperationError@src\core\exception.d(696): Invalid memory operation Why? o.O