summary refs log tree commit diff stats
path: root/tests/destructor/texplicit_move.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-09-23 16:22:31 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-09-24 16:00:57 +0200
commitc38a608c9099e987a8be0149b5190a4fc2d5fb33 (patch)
treec8f86c31980f785e5bba518eaeb8f4044cbe1217 /tests/destructor/texplicit_move.nim
parent3c461755e263ecaf7810bac25adb5d6d3f4d4a28 (diff)
downloadNim-c38a608c9099e987a8be0149b5190a4fc2d5fb33.tar.gz
C codegen: support system.move and system.wasMoved
Diffstat (limited to 'tests/destructor/texplicit_move.nim')
-rw-r--r--tests/destructor/texplicit_move.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/destructor/texplicit_move.nim b/tests/destructor/texplicit_move.nim
new file mode 100644
index 000000000..6735ac75d
--- /dev/null
+++ b/tests/destructor/texplicit_move.nim
@@ -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