summary refs log tree commit diff stats
path: root/tests/varres/tvarres_via_forwarding.nim
blob: fb7201ad279ed7287151992d498a1fc8dcda773c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
discard """
  errormsg: "'y' escapes its stack frame; context: 'forward(y)'"
  line: 10
"""

proc forward(x: var int): var int = result = x

proc foo(): var int =
  var y = 9
  result = forward(y)

echo foo()