From ebd97884a0134ba2f88e19f647585aa6133536aa Mon Sep 17 00:00:00 2001 From: Clyybber Date: Mon, 6 Jul 2020 20:53:38 +0200 Subject: [PATCH] Add testcase for #14472 (#14921) --- tests/arc/t14472.nim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/arc/t14472.nim diff --git a/tests/arc/t14472.nim b/tests/arc/t14472.nim new file mode 100644 index 0000000000..47ed77f4c3 --- /dev/null +++ b/tests/arc/t14472.nim @@ -0,0 +1,23 @@ +discard """ + valgrind: true + cmd: "nim c --gc:arc -d:useMalloc $file" +""" + +type + ImportMaterial* = object + # Adding a field here makes the problem go away. + + Mesh* = object + vertices: seq[float32] + material: ImportMaterial + + ImportedScene* = object + meshes*: seq[Mesh] + +proc bork() : ImportedScene = + var mats: seq[ImportMaterial] + + setLen(mats, 1) + add(result.meshes, Mesh(material: mats[0])) + +var s = bork()