tgcsafe.nim 329 B

123456789101112131415161718
  1. discard """
  2. line: 17
  3. errormsg: "'mainUnsafe' is not GC-safe"
  4. cmd: "nim $target --hints:on --threads:on $options $file"
  5. """
  6. proc mymap(x: proc ()) =
  7. x()
  8. var
  9. myglob: string
  10. proc mainSafe() {.gcsafe.} =
  11. mymap(proc () = echo "foo")
  12. proc mainUnsafe() {.gcsafe.} =
  13. mymap(proc () = myglob = "bar"; echo "foo", myglob)