summary refs log tree commit diff stats
path: root/tests/template/t9534.nim
blob: 8d66f42a015e371a1bef781fa9956bce32b7700a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
discard """
  targets: "c cpp"
"""

# bug #9534
type
  Object = object
    data: int

template test() =
  proc methodName(o: Object): int =
    var p: pointer
    doAssert o.data == 521
    let f {.used.} = cast[proc (o: int): int {.nimcall.}](p)
    doAssert o.data == 521
    result = 1314

  var a = Object(data: 521)
  doAssert methodName(a) == 1314

test()