diff options
author | flywind <xzsflywind@gmail.com> | 2021-04-01 14:47:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-01 08:47:59 +0200 |
commit | 6f53579a8ceb7576fb1b31f72c9d584916b4b5d9 (patch) | |
tree | 53e0de75ae04f0179d3180c0555cca8d8fca1754 /tests/template/t9534.nim | |
parent | a7bb973a24fb73d378230216a6bfcfd2f62e4e78 (diff) | |
download | Nim-6f53579a8ceb7576fb1b31f72c9d584916b4b5d9.tar.gz |
close #9534 add testcase (#17607)
Diffstat (limited to 'tests/template/t9534.nim')
-rw-r--r-- | tests/template/t9534.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/template/t9534.nim b/tests/template/t9534.nim new file mode 100644 index 000000000..8d66f42a0 --- /dev/null +++ b/tests/template/t9534.nim @@ -0,0 +1,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() |