summary refs log tree commit diff stats
path: root/tests/effects/tgcsafe.nim
blob: d146794b6017b29c41872125fcca3e5d4a5d6f52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
discard """
  line: 17
  errormsg: "'mainUnsafe' is not GC-safe"
  cmd: "nim $target --hints:on --threads:on $options $file"
"""

proc mymap(x: proc ()) =
  x()

var
  myglob: string

proc mainSafe() {.gcsafe.} =
  mymap(proc () = echo "foo")

proc mainUnsafe() {.gcsafe.} =
  mymap(proc () = myglob = "bar"; echo "foo", myglob)