* remove unnecessary when statement * remove outdated codes * close #5342 add testcase * update the example
This commit is contained in:
parent
f5a63ade7a
commit
eabb9b79b2
1 changed files with 23 additions and 0 deletions
23
tests/destructor/t5342.nim
Normal file
23
tests/destructor/t5342.nim
Normal file
|
|
@ -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"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue