mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-22 23:35:22 +00:00
fixes #11050
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user