diff --git a/tests/stdlib/tthreadpool.nim b/tests/stdlib/tthreadpool.nim new file mode 100644 index 000000000..897c7d173 --- /dev/null +++ b/tests/stdlib/tthreadpool.nim @@ -0,0 +1,14 @@ +discard """ + matrix: "--threads:on --gc:arc" + disabled: "freebsd" + output: "42" +""" + +from std/threadpool import spawn, `^`, sync +block: # bug #12005 + proc doworkok(i: int) {.thread.} = echo i + spawn(doworkok(42)) + sync() # this works when returning void! + + proc doworkbad(i: int): int {.thread.} = i + doAssert ^spawn(doworkbad(42)) == 42 # bug was here