Files
Nim/tests/effects/tgcsafe.nim
ringabout 1e15f975b8 fixes #19162; enable strictEffects for v2 (#19380)
* enable stricteffects
* add gcsafe
* fix tests
* use func
* fixes pegs tests
* explicitly mark repr related procs with noSideEffect
* add nimLegacyEffects
* change URL
* fixes docopt
* add `raises: []` to repr
* fixes weave
* fixes nimyaml
* fixes glob
* fixes parsetoml
* Apply suggestions from code review
* Update testament/important_packages.nim
* add legacy:laxEffects
2022-10-15 14:07:40 +02:00

27 lines
560 B
Nim

discard """
errormsg: "'mainUnsafe' is not GC-safe as it performs an indirect call here"
line: 26
cmd: "nim $target --hints:on --threads:on $options $file"
"""
# bug #6955
var global_proc: proc(a: string): int {.nimcall.} = nil
proc myproc(i: int) {.gcsafe.} =
if global_proc != nil:
echo "a"
if isNil(global_proc):
return
proc mymap(x: proc ()) {.effectsOf: x.} =
x()
var
myglob: string
proc mainSafe() {.gcsafe.} =
mymap(proc () = echo "foo")
proc mainUnsafe() {.gcsafe.} =
mymap(proc () = myglob = "bar"; echo "foo", myglob)