Bug 14815 – Destructor is not called for static array assignment

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-20T14:54:00Z
Last change time
2017-07-22T12:36:11Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2015-07-20T14:54:39Z
From: http://forum.dlang.org/thread/[email protected] 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?!? }
Comment #1 by k.hara.pg — 2015-07-20T15:41:45Z
Comment #2 by github-bugzilla — 2015-07-20T16:29:40Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2d1ae10a72484a86365737987d7efb7389a456c0 fix Issue 14815 - Destructor is not called for static array assignment https://github.com/D-Programming-Language/dmd/commit/ddc90f382cac62116a4610c10bb39b21a20c30a3 Merge pull request #4824 from 9rnsr/fix14815 Issue 14815 - Destructor is not called for static array assignment
Comment #3 by github-bugzilla — 2017-07-22T12:36:11Z
Commits pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/2d1ae10a72484a86365737987d7efb7389a456c0 fix Issue 14815 - Destructor is not called for static array assignment https://github.com/dlang/dmd/commit/ddc90f382cac62116a4610c10bb39b21a20c30a3 Merge pull request #4824 from 9rnsr/fix14815