tgcsafe3.nim 426 B

12345678910111213141516171819202122
  1. discard """
  2. errormsg: "'myproc' is not GC-safe as it calls 'global_proc'"
  3. line: 12
  4. cmd: "nim $target --hints:on --threads:on $options $file"
  5. """
  6. var useGcMem = "string here"
  7. var global_proc: proc(a: string) {.nimcall.} = proc (a: string) =
  8. echo useGcMem
  9. proc myproc(i: int) {.gcsafe.} =
  10. when false:
  11. if global_proc != nil:
  12. echo "a"
  13. if isNil(global_proc):
  14. return
  15. global_proc("ho")
  16. myproc(0)