diff options
author | Araq <rumpf_a@web.de> | 2015-06-18 15:05:44 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-06-18 15:06:00 +0200 |
commit | 17cace280ca927a97adc21314141947210fe17b5 (patch) | |
tree | 016bd219417ed448bd192654dba20a16313523b3 /tests/vm/tswap.nim | |
parent | bd394eaeda9bcd57daae92520d933676dc6573b9 (diff) | |
download | Nim-17cace280ca927a97adc21314141947210fe17b5.tar.gz |
fixes #2297, fixes #2946
Diffstat (limited to 'tests/vm/tswap.nim')
-rw-r--r-- | tests/vm/tswap.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/vm/tswap.nim b/tests/vm/tswap.nim new file mode 100644 index 000000000..2219be9ca --- /dev/null +++ b/tests/vm/tswap.nim @@ -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() |