summary refs log tree commit diff stats
path: root/tests/objects
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 /tests/objects
parent29a43124cf978d56021af7c37c75a5d92e48cc3f (diff)
downloadNim-f524d60fa1e1c3a3722632e2a01bf93c6cb02e88.tar.gz
fixes #22123; Compiler bug with default initializer values and arrays (#22128)
Diffstat (limited to 'tests/objects')
-rw-r--r--tests/objects/tobject_default_value.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/objects/tobject_default_value.nim b/tests/objects/tobject_default_value.nim
index b571965ea..2d86dce11 100644
--- a/tests/objects/tobject_default_value.nim
+++ b/tests/objects/tobject_default_value.nim
@@ -688,6 +688,20 @@ template main {.dirty.} =
     else:
       testAssignResult()
 
+  block: # bug #22123
+    type Thing = object
+      x: float32 = 1
+
+    type ThingWithArray = object
+        arr: array[256, float32]
+        n: float32 = 1
+
+    type Container = ref object
+        thing: array[5, Thing]
+        thing_with_array: array[5, ThingWithArray]
+
+    var foo = new Container
+    doAssert int(foo.thing[0].x) == 1
 
 static: main()
 main()