summary refs log tree commit diff stats
path: root/tests/effects
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-08-12 08:47:31 +0200
committerAraq <rumpf_a@web.de>2014-08-12 08:47:31 +0200
commitb8ce3a41753fa3aeeeee1e91401e9909d63cfbe7 (patch)
tree1ee182fb5ae5f9bbf8b2980131815f3e35b59f81 /tests/effects
parent05dbba0e3899d86a4f7dbc6e81b1b5f9771aa2e0 (diff)
downloadNim-b8ce3a41753fa3aeeeee1e91401e9909d63cfbe7.tar.gz
fixes 'gcsafe'
Diffstat (limited to 'tests/effects')
-rw-r--r--tests/effects/teffects1.nim2
-rw-r--r--tests/effects/tgcsafe.nim16
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/effects/teffects1.nim b/tests/effects/teffects1.nim
index 0014cff46..f73230ff9 100644
--- a/tests/effects/teffects1.nim
+++ b/tests/effects/teffects1.nim
@@ -1,5 +1,5 @@
 discard """
-  line: 1913
+  line: 2136
   file: "system.nim"
   errormsg: "can raise an unlisted exception: ref EIO"
 """
diff --git a/tests/effects/tgcsafe.nim b/tests/effects/tgcsafe.nim
new file mode 100644
index 000000000..87388238a
--- /dev/null
+++ b/tests/effects/tgcsafe.nim
@@ -0,0 +1,16 @@
+discard """
+  line: 15
+  errormsg: "'mainUnsafe' is not GC-safe"
+"""
+
+proc mymap(x: proc ()) =
+  x()
+
+var
+  myglob: string
+
+proc mainSafe() {.gcsafe.} =
+  mymap(proc () = echo "foo")
+
+proc mainUnsafe() {.gcsafe.} =
+  mymap(proc () = myglob = "bar"; echo "foo", myglob)