This commit is contained in:
parent
e2886eebb4
commit
0d8942d45e
7 changed files with 175 additions and 15 deletions
20
tests/generics/tdictdestruct.nim
Normal file
20
tests/generics/tdictdestruct.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
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) {.nimcall.}) =
|
||||
discard
|
||||
|
||||
proc destroyDict[TK, TV](a: PDict[TK, TV]) =
|
||||
return
|
||||
proc newDict[TK, TV](a: TK, b: TV): PDict[TK, TV] =
|
||||
fakeNew(result, destroyDict[TK, TV])
|
||||
|
||||
# Problem: destroyDict is not instantiated when newDict is instantiated!
|
||||
|
||||
discard newDict("a", "b")
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue