tdeepcopy_addr_rval.nim 221 B

123456789101112131415161718
  1. discard """
  2. matrix: "--mm:refc; --mm:orc --deepcopy:on"
  3. output: "3"
  4. """
  5. # issue 5166
  6. type
  7. Test = ref object
  8. x: int
  9. let x = Test(x: 3)
  10. let p = cast[pointer](x)
  11. var v: Test
  12. deepCopy(v, cast[Test](p))
  13. echo v.x