diff options
author | Araq <rumpf_a@web.de> | 2015-08-05 21:27:53 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-08-05 21:43:14 +0200 |
commit | 0d8942d45e5d477224d486ab66adfcf38230aa8b (patch) | |
tree | e4bc33fa6ba0a9e9aa1438917d16453b7daf4d03 /tests/generics | |
parent | e2886eebb48bbb5a5b10bc30f448df2411102326 (diff) | |
download | Nim-0d8942d45e5d477224d486ab66adfcf38230aa8b.tar.gz |
destructors now work with overloaded assignment operators; fixes #2811; fixes #1632
Diffstat (limited to 'tests/generics')
-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..17ded4853 --- /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") + + |