summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-06-20 14:02:06 +0800
committerGitHub <noreply@github.com>2023-06-20 08:02:06 +0200
commitf524d60fa1e1c3a3722632e2a01bf93c6cb02e88 (patch)
tree5f6b18101d4215d3070d8dd9dedbb12329735b33 /lib/system.nim
parent29a43124cf978d56021af7c37c75a5d92e48cc3f (diff)
downloadNim-f524d60fa1e1c3a3722632e2a01bf93c6cb02e88.tar.gz
fixes #22123; Compiler bug with default initializer values and arrays (#22128)
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 949d717b0..2290ff6f6 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2801,7 +2801,10 @@ when notJSnotNims and not defined(nimSeqsV2):
       assert y == "abcgh"
     discard
 
-proc nimArrayWith[T](y: T, size: static int): array[size, T] {.compilerRtl, raises: [].} =
+proc arrayWith*[T](y: T, size: static int): array[size, T] {.raises: [].} =
   ## Creates a new array filled with `y`.
   for i in 0..size-1:
-    result[i] = y
+    when nimvm:
+      result[i] = y
+    else:
+      result[i] = `=dup`(y)