summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/tanya/memory/types.d17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/tanya/memory/types.d b/source/tanya/memory/types.d
index af0f1ac..4efb1ca 100644
--- a/source/tanya/memory/types.d
+++ b/source/tanya/memory/types.d
@@ -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);
+}