diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-03-05 19:54:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-05 19:54:44 +0100 |
commit | c86b1fbcac11520380ad15e103a8ec429228d735 (patch) | |
tree | 99630c61a0c9648eb6a116da65a78b5cc77d119d /tests/effects | |
parent | aed8766e84364360e0ed1e1e667ee735afd99e81 (diff) | |
download | Nim-c86b1fbcac11520380ad15e103a8ec429228d735.tar.gz |
fixes a critical GC safety inference bug (#10615)
* fixes a critical GC safety inference bug * make nimsuggest compile again * make Nimble compile again
Diffstat (limited to 'tests/effects')
-rw-r--r-- | tests/effects/tgcsafe3.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/effects/tgcsafe3.nim b/tests/effects/tgcsafe3.nim new file mode 100644 index 000000000..5137efe4c --- /dev/null +++ b/tests/effects/tgcsafe3.nim @@ -0,0 +1,21 @@ +discard """ + errormsg: "'myproc' is not GC-safe as it accesses 'global_proc' which is a global using GC'ed memory" + 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) |