diff options
Diffstat (limited to 'tests/destructor/t5342.nim')
-rw-r--r-- | tests/destructor/t5342.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/destructor/t5342.nim b/tests/destructor/t5342.nim new file mode 100644 index 000000000..0acd5ef9d --- /dev/null +++ b/tests/destructor/t5342.nim @@ -0,0 +1,24 @@ +discard """ + matrix: "--mm:refc; --mm:arc" + targets: "c js" + output: ''' +1 +2 +here +2 +1 +''' +""" + + +type + A = object + id: int + B = object + a: A +proc `=destroy`(a: var A) = echo a.id +var x = A(id: 1) +var y = B(a: A(id: 2)) +`=destroy`(x) +`=destroy`(y) +echo "here" \ No newline at end of file |