diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2022-08-19 13:42:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-19 13:42:08 +0200 |
commit | b1fe1690c48fc3c24e3db2b2e2d12961f46f36f9 (patch) | |
tree | 85e597e1488e451775ed27defe667b73618ad171 /tests/ccgbugs | |
parent | 1c31de361d345c7cfc9ac2ca7a3040bdfa649d9a (diff) | |
download | Nim-b1fe1690c48fc3c24e3db2b2e2d12961f46f36f9.tar.gz |
fixes #20107 (#20246) [backport]
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r-- | tests/ccgbugs/tderefblock.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ccgbugs/tderefblock.nim b/tests/ccgbugs/tderefblock.nim new file mode 100644 index 000000000..55253da10 --- /dev/null +++ b/tests/ccgbugs/tderefblock.nim @@ -0,0 +1,24 @@ +discard """ + cmd: "nim c -d:release -d:danger $file" + 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() |