Nim/tests/ccgbugs/t20141.nim
ringabout e33e9e4a32
fixes #20141; dereferencing pointer to incomplete type error with cast (#20147)
Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
2022-09-28 13:57:47 +02:00

27 lines
No EOL
354 B
Nim

discard """
joinable: false
"""
# bug #20141
type
A = object
B = object
U = proc()
proc m(h: var B) = discard
template n[T, U](x: U): T =
static: doAssert true
cast[ptr T](addr x)[]
proc k() =
var res: A
m(n[B](res))
proc w(mounter: U) = discard
proc mount(proto: U) = discard
proc v() = mount k
# This is required for failure
w(v)