summary refs log tree commit diff stats
path: root/tests/destructor
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-04-17 17:26:59 +0200
committerAraq <rumpf_a@web.de>2019-04-17 17:26:59 +0200
commit7640a230fc6166bb7fcc18bcab4251d7f6dc6caf (patch)
treef5ff43cfe6f85b46eb2f4a3eef3f3c4ecbb59295 /tests/destructor
parent850e90ac303cf791369e5fe4827fa1ab2269bdad (diff)
downloadNim-7640a230fc6166bb7fcc18bcab4251d7f6dc6caf.tar.gz
fixes #11050
Diffstat (limited to 'tests/destructor')
-rw-r--r--tests/destructor/tgcdestructors.nim21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/destructor/tgcdestructors.nim b/tests/destructor/tgcdestructors.nim
index 620ba7d66..c0a88e650 100644
--- a/tests/destructor/tgcdestructors.nim
+++ b/tests/destructor/tgcdestructors.nim
@@ -4,7 +4,8 @@ discard """
 ho
 ha
 @["arg", "asdfklasdfkl", "asdkfj", "dfasj", "klfjl"]
-22 22'''
+@[1, 2, 3]
+25 25'''
 """
 
 import allocators
@@ -132,6 +133,24 @@ proc other =
 
 other()
 
+# bug #11050
+
+type
+  Obj* = object
+    f*: seq[int]
+
+method main(o: Obj) =
+  for newb in o.f:
+    discard
+
+# test that o.f was not moved!
+proc testforNoMove =
+  var o = Obj(f: @[1, 2, 3])
+  main(o)
+  echo o.f
+
+testforNoMove()
+
 #echo s
 let (a, d) = allocCounters()
 discard cprintf("%ld %ld\n", a, d)