digitalmars.D.bugs - [Issue 14815] New: Destructor is not called for static array
- via Digitalmars-d-bugs (29/29) Jul 20 2015 https://issues.dlang.org/show_bug.cgi?id=14815
https://issues.dlang.org/show_bug.cgi?id=14815 Issue ID: 14815 Summary: Destructor is not called for static array assignment Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: wrong-code Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: k.hara.pg gmail.com From: http://forum.dlang.org/thread/gzbesjblexmtwnigfvgo forum.dlang.org uint dtorCount; struct S { uint x; void opAssign(const ref S rhs) { assert(false, "Not called"); } ~this() { ++dtorCount; } } void main() { S[2] a; a[0].x = 42; a = a.init; assert(a[0].x == 0); // as expected the value has been reset assert(dtorCount == 0); // Passes?!? } --
Jul 20 2015