summary refs log tree commit diff stats
path: root/tests/destructor/tmove.nim
blob: 2762aff900393273173a03f6838faae729e9fac4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
discard """
  targets: "c cpp"
"""

block:
  var called = 0

  proc bar(a: var int): var int =
    inc called
    result = a

  proc foo =
    var a = 2
    var s = move bar(a)
    doAssert called == 1
    doAssert s == 2

  foo()