Files
Nim/tests/effects/tgcsafe3.nim
Andreas Rumpf 90a2b5afd8 correct effect tracking for .borrowed procs [backport] (#18882)
* correct effect tracking for .borrowed procs [backport]

* progress

* fix error message in a test

* correctly fix it

Co-authored-by: narimiran <narimiran@disroot.org>
2021-09-23 16:47:24 +02:00

22 lines
426 B
Nim

discard """
errormsg: "'myproc' is not GC-safe as it calls 'global_proc'"
line: 12
cmd: "nim $target --hints:on --threads:on $options $file"
"""
var useGcMem = "string here"
var global_proc: proc(a: string) {.nimcall.} = proc (a: string) =
echo useGcMem
proc myproc(i: int) {.gcsafe.} =
when false:
if global_proc != nil:
echo "a"
if isNil(global_proc):
return
global_proc("ho")
myproc(0)