summary refs log tree commit diff stats
path: root/tests/ccgbugs/tdeepcopy_addr_rval.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ccgbugs/tdeepcopy_addr_rval.nim')
-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