diff options
Diffstat (limited to 'tests/generics/tdictdestruct.nim')
-rw-r--r-- | tests/generics/tdictdestruct.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/generics/tdictdestruct.nim b/tests/generics/tdictdestruct.nim new file mode 100644 index 000000000..228d93e66 --- /dev/null +++ b/tests/generics/tdictdestruct.nim @@ -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") + + |