diff options
author | Araq <rumpf_a@web.de> | 2019-04-17 17:26:59 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-04-17 17:26:59 +0200 |
commit | 7640a230fc6166bb7fcc18bcab4251d7f6dc6caf (patch) | |
tree | f5ff43cfe6f85b46eb2f4a3eef3f3c4ecbb59295 /tests/destructor | |
parent | 850e90ac303cf791369e5fe4827fa1ab2269bdad (diff) | |
download | Nim-7640a230fc6166bb7fcc18bcab4251d7f6dc6caf.tar.gz |
fixes #11050
Diffstat (limited to 'tests/destructor')
-rw-r--r-- | tests/destructor/tgcdestructors.nim | 21 |
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) |