summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorBrandon Pickering <brandonpickering95@gmail.com>2017-01-14 21:26:59 -0800
committerAndreas Rumpf <rumpf_a@web.de>2017-01-15 06:26:59 +0100
commit9f95dd8e1d8a43bbb790dc6ec9aa6668b01230c6 (patch)
treecc7b62194cfef4092e762f5f4161d39472e9a424 /tests
parent03916fa3b1a07eb4cbd88cf3afe359695caf5446 (diff)
downloadNim-9f95dd8e1d8a43bbb790dc6ec9aa6668b01230c6.tar.gz
Create temp var in deepcopy if needed (#5205)
Diffstat (limited to 'tests')
-rw-r--r--tests/ccgbugs/tdeepcopy_addr_rval.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ccgbugs/tdeepcopy_addr_rval.nim b/tests/ccgbugs/tdeepcopy_addr_rval.nim
new file mode 100644
index 000000000..07fb8f8ef
--- /dev/null
+++ b/tests/ccgbugs/tdeepcopy_addr_rval.nim
@@ -0,0 +1,16 @@
+discard """
+  output: "3"
+"""
+
+# issue 5166
+
+type
+  Test = ref object
+    x: int
+
+let x = Test(x: 3)
+let p = cast[pointer](x)
+
+var v: Test
+deepCopy(v, cast[Test](p))
+echo v.x