summary refs log tree commit diff stats
path: root/tests/arc/t14472.nim
blob: 4ef6611617c722d48f870722bc68d426ee65dab0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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()