summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorAlexander Kernozhitsky <sh200105@mail.ru>2024-07-06 23:10:15 +0200
committerGitHub <noreply@github.com>2024-07-06 23:10:15 +0200
commit1dcc364cd2e284f831735e0fe9b988b08c82ac4f (patch)
treeecbab6824bc08b934be77502c1795414e034826b /tests/ccgbugs
parentce75042a9dbf51707da6175157df8ebc22bd516b (diff)
downloadNim-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.nim25
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)