Bug 10194 – std.variant.Variant doesn't call the dtor of struct values

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-28T07:50:25Z
Last change time
2017-08-26T17:24:00Z
Assigned to
No Owner
Creator
Martin Nowak

Comments

Comment #0 by code — 2013-05-28T07:50:25Z
Failing test case ---- import std.variant; unittest { static struct S { ~this() { ++cnt; } static size_t cnt; } Variant v; // assigning a new value should destroy the existing one { v = S(); immutable n = S.cnt; v = 0; assert(S.cnt == n + 1); } // destroying the variant should destroy it's current value { v = S(); immutable n = S.cnt; destroy(v); assert(S.cnt == n + 1); } }
Comment #1 by yuriy.glukhov — 2014-05-06T10:10:14Z
Comment #2 by github-bugzilla — 2014-07-14T10:40:27Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/0c40d1ea641f4e51a6ec4de6fe0cd1bcda65d944 Issue 10194. Variant does not call struct destructors. https://github.com/D-Programming-Language/phobos/commit/45fda72192ff5b878ebe915db0ffb9f6504cca8f Merge pull request #2147 from yglukhov/issue10194 Issue 10194. Variant does not call struct destructors.