tderefblock.nim 322 B

1234567891011121314151617181920212223242526
  1. discard """
  2. cmd: "nim c -d:release -d:danger $file"
  3. matrix: ";--gc:orc"
  4. output: "42"
  5. """
  6. # bug #20107
  7. type Foo = object
  8. a, b, c, d: uint64
  9. proc c(i: uint64): Foo =
  10. Foo(a: i, b: i, c: i, d: i)
  11. func x(f: Foo): lent Foo {.inline.} =
  12. f
  13. proc m() =
  14. let f = block:
  15. let i = c(42)
  16. x(i)
  17. echo $f.a
  18. m()