Add unittest to check RefCounted calles struct destructors

This commit is contained in:
Eugen Wissner 2017-04-16 20:52:24 +02:00
parent 628153e2e8
commit eb360bda38
1 changed files with 17 additions and 0 deletions

View File

@ -495,3 +495,20 @@ private @nogc unittest
auto rc = defaultAllocator.refCounted!(int[])(5);
assert(rc.length == 5);
}
private @nogc unittest
{
static bool destroyed = false;
struct F
{
~this() @nogc
{
destroyed = true;
}
}
{
auto rc = defaultAllocator.refCounted!F();
}
assert(destroyed);
}