summary refs log tree commit diff stats
path: root/tests/accept/compile/tdictdestruct.nim
blob: 9c1f27ed8a8dd9a9526e6d73b633acad3b4717ba (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
discard """
  disabled: true
"""

type
  TDict[TK, TV] = object
    k: TK
    v: TV
  PDict[TK, TV] = ref TDict[TK, TV]

proc fakeNew[T](x: var ref T, destroy: proc (a: ref T)) =
  nil

proc destroyDict[TK, TV](a: PDict[TK, TV]) =
    return
proc newDict[TK, TV](a: TK, b: TV): PDict[TK, TV] =
    Fakenew(result, destroyDict)

# Problem: destroyDict is not instantiated when newDict is instantiated!    

discard newDict("a", "b")