diff options
author | Araq <rumpf_a@web.de> | 2019-08-12 14:06:48 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-08-12 14:06:48 +0200 |
commit | 322ce1872fd13e7b3029db800727ecdc886ad8a3 (patch) | |
tree | c5a88619eb47302b8e700a99144eca65c67a80cb /tests | |
parent | 289b5e9ef93cd350e75f4d90d264e56df64c5a8d (diff) | |
download | Nim-322ce1872fd13e7b3029db800727ecdc886ad8a3.tar.gz |
fixes #10689
Diffstat (limited to 'tests')
-rw-r--r-- | tests/destructor/tnewruntime_misc.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/destructor/tnewruntime_misc.nim b/tests/destructor/tnewruntime_misc.nim index 1fb5b0151..0e9541e2e 100644 --- a/tests/destructor/tnewruntime_misc.nim +++ b/tests/destructor/tnewruntime_misc.nim @@ -3,6 +3,7 @@ discard """ output: '''(field: "value") Indeed axc +(v: 10) 0 new: 0''' """ @@ -58,5 +59,21 @@ proc test(p: owned proc()) = test(proc() = discard) +# bug #10689 + +type + O = object + v: int + +proc `=sink`(d: var O, s: O) = + d.v = s.v + +proc selfAssign = + var o = O(v: 10) + o = o + echo o + +selfAssign() + let (a, d) = allocCounters() discard cprintf("%ld new: %ld\n", a - unpairedEnvAllocs() - d, allocs) |