[Issue 19218] object.destroy should check for classes for static arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 14 18:14:03 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19218
karita <shigekikarita at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |shigekikarita at gmail.com
--- Comment #1 from karita <shigekikarita at gmail.com> ---
I agree with you. I made a unittest for checking this
---
unittest
{
struct S
{
static dtorCount = 0;
~this() { ++dtorCount; }
}
class C
{
static dtorCount = 0;
~this() { ++dtorCount; }
}
struct A(T)
{
T[3] a;
alias a this;
}
auto as = new A!S;
destroy(as);
auto ac = new A!C;
destroy(as);
assert(S.dtorCount == 3); // 0
assert(C.dtorCount == 3); // 0
}
--
More information about the Digitalmars-d-bugs
mailing list