t14472.nim 748 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. discard """
  2. valgrind: true
  3. cmd: "nim cpp --gc:arc -d:useMalloc --deepcopy:on $file"
  4. """
  5. type
  6. ImportMaterial* = object
  7. # Adding a field here makes the problem go away.
  8. Mesh* = object
  9. vertices: seq[float32]
  10. material: ImportMaterial
  11. ImportedScene* = object
  12. meshes*: seq[Mesh]
  13. proc bork() : ImportedScene =
  14. result = ImportedScene()
  15. var mats: seq[ImportMaterial] = @[]
  16. setLen(mats, 1)
  17. add(result.meshes, Mesh(material: mats[0]))
  18. var s = bork()
  19. #------------------------------------------------------------------------
  20. # issue #15543
  21. import tables
  22. type
  23. cdbl {.importc: "double".} = object
  24. MyObject = ref object of RootObj
  25. y: Table[string, cdbl]
  26. proc test =
  27. var x = new(MyObject)
  28. test()