t9534.nim 362 B

12345678910111213141516171819202122
  1. discard """
  2. targets: "c cpp"
  3. """
  4. # bug #9534
  5. type
  6. Object = object
  7. data: int
  8. template test() =
  9. proc methodName(o: Object): int =
  10. var p: pointer
  11. doAssert o.data == 521
  12. let f {.used.} = cast[proc (o: int): int {.nimcall.}](p)
  13. doAssert o.data == 521
  14. result = 1314
  15. var a = Object(data: 521)
  16. doAssert methodName(a) == 1314
  17. test()