diff options
author | flywind <xzsflywind@gmail.com> | 2021-03-02 17:24:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 10:24:45 +0100 |
commit | eabb9b79b2decedbe867a6a515feb77c9e3d02a1 (patch) | |
tree | 2e13642c61f7c52cad4bf1cf3a5ccd2a6189af2c | |
parent | f5a63ade7a0d38312140e069bf9880d439cdc811 (diff) | |
download | Nim-eabb9b79b2decedbe867a6a515feb77c9e3d02a1.tar.gz |
close #5342 add testcase (#17230)
* remove unnecessary when statement * remove outdated codes * close #5342 add testcase * update the example
-rw-r--r-- | tests/destructor/t5342.nim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/destructor/t5342.nim b/tests/destructor/t5342.nim new file mode 100644 index 000000000..19354ea64 --- /dev/null +++ b/tests/destructor/t5342.nim @@ -0,0 +1,23 @@ +discard """ + matrix: "--gc:refc; --gc:arc" + 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 |