digitalmars.D.bugs - [Issue 18592] New: Associative array assignment with a destructor
- d-bugmail puremagic.com (37/37) Mar 11 2018 https://issues.dlang.org/show_bug.cgi?id=18592
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: nobody puremagic.com Reporter: greensunny12 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; } --
Mar 11 2018