summary refs log tree commit diff stats
path: root/tests/destructor/t5342.nim
blob: 19354ea64d1749bea70069ec7a99ec768481bb99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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"