diff tangotests/mem4.d @ 209:c4c9b4ac021b trunk

[svn r225] Fixed: delete expressions no longer use llvm's free instruction, which crashes on a GC provided pointer.
author lindquist
date Wed, 14 May 2008 01:22:40 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tangotests/mem4.d	Wed May 14 01:22:40 2008 +0200
@@ -0,0 +1,29 @@
+module tangotests.mem4;
+
+import tango.stdc.stdio;
+
+class C {
+    int* ptr;
+    this() {
+        printf("this()\n");
+        ptr = new int;
+    }
+    ~this() {
+        printf("~this()\n");
+        delete ptr;
+        assert(ptr is null);
+    }
+    final void check()
+    {
+        printf("check()\n");
+        assert(ptr !is null);
+    }
+}
+
+void main()
+{
+    C c = new C();
+    c.check();
+    delete c;
+    assert(c is null);
+}
\ No newline at end of file