C codegen: support system.move and system.wasMoved
This commit is contained in:
parent
3c461755e2
commit
c38a608c90
2 changed files with 38 additions and 0 deletions
19
tests/destructor/texplicit_move.nim
Normal file
19
tests/destructor/texplicit_move.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
discard """
|
||||
output: '''3
|
||||
0
|
||||
destroyed!'''
|
||||
"""
|
||||
|
||||
type
|
||||
myseq* = object
|
||||
f: int
|
||||
|
||||
proc `=destroy`*(x: var myseq) =
|
||||
echo "destroyed!"
|
||||
|
||||
var
|
||||
x: myseq
|
||||
x.f = 3
|
||||
echo move(x.f)
|
||||
echo x.f
|
||||
Loading…
Add table
Add a link
Reference in a new issue