summary refs log tree commit diff stats
path: root/tests/destructor/texplicit_move.nim
blob: 93795af42816cd352ae09c564e5e96e2ea759795 (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
24
25
26
27
28
29
30
discard """
  output: '''3
0
0
10
destroyed!
'''
joinable: false
"""

type
  myseq* = object
    f: int

proc `=destroy`*(x: var myseq) =
  echo "destroyed!"

var
  x: myseq
x.f = 3
echo move(x.f)
echo x.f

# bug #9743
let a = create int
a[] = 10
var b = move a[]
echo a[]
echo b