fixes #11050
This commit is contained in:
parent
850e90ac30
commit
7640a230fc
3 changed files with 34 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue