diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-06-20 14:02:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-20 08:02:06 +0200 |
commit | f524d60fa1e1c3a3722632e2a01bf93c6cb02e88 (patch) | |
tree | 5f6b18101d4215d3070d8dd9dedbb12329735b33 /tests/objects | |
parent | 29a43124cf978d56021af7c37c75a5d92e48cc3f (diff) | |
download | Nim-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.nim | 14 |
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() |