summary refs log tree commit diff stats
path: root/tests/effects/tgcsafe3.nim
blob: 36ea5112cdc0c6230c86b132e6f55661f58ac373 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)