summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2017-04-16 20:52:24 +0200
committerEugen Wissner <belka@caraus.de>2017-04-16 20:52:24 +0200
commiteb360bda387063d970669bf2683dca484a673cea (patch)
tree68ba6ee7ee9cc7f160408b3562248f11060d7586 /source
parent628153e2e88063a9c20b39ec64c05ef0007fb0b9 (diff)
downloadtanya-eb360bda387063d970669bf2683dca484a673cea.tar.gz
Add unittest to check RefCounted calles struct destructors
Diffstat (limited to 'source')
-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);
+}