summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-08-20 01:56:52 +0800
committerGitHub <noreply@github.com>2021-08-19 19:56:52 +0200
commit13b97291835046eb1368ff4cd240cdcc7d0a2899 (patch)
tree6b6aeb5c0f50aa2cc74cbf229fcb417dd080c559 /tests
parent8fa0decf6b4917e5559b9fd84a18825849dc11df (diff)
downloadNim-13b97291835046eb1368ff4cd240cdcc7d0a2899.tar.gz
fix #18627(Program segfaults with ARC when using openArray[string]) (#18713)
* fix #18627
* add testcase
* rename
* another
* remove tyVarargs
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/topenarray.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/arc/topenarray.nim b/tests/arc/topenarray.nim
new file mode 100644
index 000000000..03ec7adf2
--- /dev/null
+++ b/tests/arc/topenarray.nim
@@ -0,0 +1,24 @@
+discard """
+  input: "hi"
+  output: '''
+hi
+Nim
+'''
+  matrix: "--gc:arc -d:useMalloc; --gc:arc"
+"""
+block: # bug 18627
+  proc setPosition(params: openArray[string]) =
+    for i in params.toOpenArray(0, params.len - 1):
+      echo i
+
+  proc uciLoop() =
+    let params = @[readLine(stdin)]
+    setPosition(params)
+
+  uciLoop()
+
+  proc uciLoop2() =
+    let params = @["Nim"]
+    for i in params.toOpenArray(0, params.len - 1):
+      echo i
+  uciLoop2()