https://issues.dlang.org/show_bug.cgi?id=18592
Issue ID: 18592 Summary: Associative array assignment with a destructor should be @safe if the destructor is @safe Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: greensunn...@gmail.com cat > main.d << EOF void main() @safe { struct ThrowingElement { int i; ~this() { assert(1); } } ThrowingElement[int] aa; aa[0] = ThrowingElement(0); } EOF The problem is that the generated opAssign is @system: ref return @system ThrowingElement opAssign(ThrowingElement p) { (ThrowingElement __swap2 = void;) , __swap2 = this , this = p , __swap2.~this(); return this; } --