summary refs log tree commit diff stats
path: root/tests/threads/tthreadheapviolation1.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/threads/tthreadheapviolation1.nim')
-rw-r--r--tests/threads/tthreadheapviolation1.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/threads/tthreadheapviolation1.nim b/tests/threads/tthreadheapviolation1.nim
new file mode 100644
index 000000000..379bd55e6
--- /dev/null
+++ b/tests/threads/tthreadheapviolation1.nim
@@ -0,0 +1,18 @@
+discard """
+  errormsg: "'horrible' is not GC-safe"
+  line: 11
+  cmd: "nim $target --hints:on --threads:on $options $file"
+"""
+
+var
+  global: string = "test string"
+  t: Thread[void]
+
+proc horrible() {.thread.} =
+  global = "string in thread local heap!"
+  var x = global
+  var mydata = (x, "my string too")
+  echo global
+
+createThread[void](t, horrible)
+joinThread(t)