mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 18:32:11 +00:00
* remove unnecessary when statement * remove outdated codes * close #5342 add testcase * update the example
23 lines
250 B
Nim
23 lines
250 B
Nim
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" |