Create temp var in deepcopy if needed (#5205)
This commit is contained in:
parent
03916fa3b1
commit
9f95dd8e1d
2 changed files with 27 additions and 2 deletions
16
tests/ccgbugs/tdeepcopy_addr_rval.nim
Normal file
16
tests/ccgbugs/tdeepcopy_addr_rval.nim
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue