diff options
author | Alexander Kernozhitsky <sh200105@mail.ru> | 2024-07-06 23:10:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-06 23:10:15 +0200 |
commit | 1dcc364cd2e284f831735e0fe9b988b08c82ac4f (patch) | |
tree | ecbab6824bc08b934be77502c1795414e034826b /tests/ccgbugs | |
parent | ce75042a9dbf51707da6175157df8ebc22bd516b (diff) | |
download | Nim-1dcc364cd2e284f831735e0fe9b988b08c82ac4f.tar.gz |
[backport] fixes #23796; remove extra indirection for args in importc'ed functions in cpp (#23800)
fixes #23796
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r-- | tests/ccgbugs/t23796.nim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ccgbugs/t23796.nim b/tests/ccgbugs/t23796.nim new file mode 100644 index 000000000..421ec04d8 --- /dev/null +++ b/tests/ccgbugs/t23796.nim @@ -0,0 +1,25 @@ +discard """ + targets: "c cpp" +""" + +# bug #23796 + +{.emit: """ +#ifdef __cplusplus +extern "C" { +#endif + +void fooArr(float data[3]) {} +void fooIntArr(int id, float data[3]) {} + +#ifdef __cplusplus +} +#endif +""".} + +proc fooArr(data: var array[3, cfloat]) {.importc.} +proc fooIntArr(id: cint, data: var array[3, cfloat]) {.importc, nodecl.} + +var arr = [cfloat 1, 2, 3] +fooArr(arr) +fooIntArr(1, arr) |