summary refs log tree commit diff stats
path: root/tests/ccgbugs/tderefblock.nim
blob: fd21a19b87bdaee6c8f59f390dec0c97a46cbc5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
discard """
  cmd: "nim c -d:release -d:danger $file"
  matrix: ";--gc:orc"
  output: "42"
"""

# bug #20107

type Foo = object
  a, b, c, d: uint64

proc c(i: uint64): Foo =
  Foo(a: i, b: i, c: i, d: i)

func x(f: Foo): lent Foo {.inline.} =
  f

proc m() =
  let f = block:
    let i = c(42)
    x(i)

  echo $f.a

m()