summary refs log tree commit diff stats
path: root/tests/ccgbugs/t20141.nim
blob: 499cd21aa032b10a69f8c69a790631d571c57d0d (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
26
27
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)