parent
bd394eaeda
commit
17cace280c
6 changed files with 127 additions and 19 deletions
24
tests/vm/tswap.nim
Normal file
24
tests/vm/tswap.nim
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
discard """
|
||||
msg: '''
|
||||
x.data = @[10]
|
||||
y = @[11]
|
||||
x.data = @[11]
|
||||
y = @[10]'''
|
||||
"""
|
||||
|
||||
# bug #2946
|
||||
|
||||
proc testSwap(): int {.compiletime.} =
|
||||
type T = object
|
||||
data: seq[int]
|
||||
var x: T
|
||||
x.data = @[10]
|
||||
var y = @[11]
|
||||
echo "x.data = ", x.data
|
||||
echo "y = ", y
|
||||
swap(y, x.data)
|
||||
echo "x.data = ", x.data
|
||||
echo "y = ", y
|
||||
result = 99
|
||||
|
||||
const something = testSwap()
|
||||
Loading…
Add table
Add a link
Reference in a new issue