fixes #22123; Compiler bug with default initializer values and arrays (#22128)

This commit is contained in:
ringabout
2023-06-20 14:02:06 +08:00
committed by GitHub
parent 29a43124cf
commit f524d60fa1
3 changed files with 23 additions and 6 deletions

View File

@@ -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()