summary refs log tree commit diff stats
path: root/tests/arc/t14472.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arc/t14472.nim')
-rw-r--r--tests/arc/t14472.nim43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/arc/t14472.nim b/tests/arc/t14472.nim
new file mode 100644
index 000000000..4ef661161
--- /dev/null
+++ b/tests/arc/t14472.nim
@@ -0,0 +1,43 @@
+discard """
+  valgrind: true
+  cmd: "nim cpp --gc:arc -d:useMalloc --deepcopy:on $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()
+
+
+#------------------------------------------------------------------------
+# issue #15543
+
+import tables
+
+type
+  cdbl {.importc: "double".} = object
+
+  MyObject = ref object of RootObj
+    y: Table[string, cdbl]
+        
+
+proc test =
+  var x = new(MyObject)
+
+test()
+
+