diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-11-20 00:52:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 17:52:42 +0100 |
commit | 5dafcf4957a225b1f015d131299e51735e7bb1d3 (patch) | |
tree | 8a65d81d0ac090abf2af634d63f6f7aec89e4cc9 /tests/pragmas | |
parent | 6c5283b194ec238c765c2e0a8f252db003643557 (diff) | |
download | Nim-5dafcf4957a225b1f015d131299e51735e7bb1d3.tar.gz |
fixes #22913; fixes #12985 differently push-ing pragma exportc genera… (#22941)
…tes invalid C identifiers fixes #22913 fixes #12985 differently `{.push.} now does not apply to generic instantiations`
Diffstat (limited to 'tests/pragmas')
-rw-r--r-- | tests/pragmas/tpush.nim | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/pragmas/tpush.nim b/tests/pragmas/tpush.nim index 6d7eade91..6a95f1ca0 100644 --- a/tests/pragmas/tpush.nim +++ b/tests/pragmas/tpush.nim @@ -38,3 +38,42 @@ proc main(): void = {.push staticBoundChecks: on.} main() + + +proc timnFoo[T](obj: T) {.noSideEffect.} = discard # BUG + +{.push exportc.} +proc foo1() = + var s1 = "bar" + timnFoo(s1) + var s2 = @[1] + timnFoo(s2) +{.pop.} + + +block: # bug #22913 + block: + type r = object + + template std[T](x: T) = + let ttt {.used.} = x + result = $ttt + + proc bar[T](x: T): string = + std(x) + + {.push exportc: "$1".} + proc foo(): r = + let s = bar(123) + {.pop.} + + discard foo() + + block: + type r = object + {.push exportc: "$1".} + proc foo2(): r = + let s = $result + {.pop.} + + discard foo2() |