summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-08-12 14:06:48 +0200
committerAraq <rumpf_a@web.de>2019-08-12 14:06:48 +0200
commit322ce1872fd13e7b3029db800727ecdc886ad8a3 (patch)
treec5a88619eb47302b8e700a99144eca65c67a80cb /tests
parent289b5e9ef93cd350e75f4d90d264e56df64c5a8d (diff)
downloadNim-322ce1872fd13e7b3029db800727ecdc886ad8a3.tar.gz
fixes #10689
Diffstat (limited to 'tests')
-rw-r--r--tests/destructor/tnewruntime_misc.nim17
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)