summary refs log tree commit diff stats
path: root/tests/misc/mimportc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc/mimportc.nim')
-rw-r--r--tests/misc/mimportc.nim26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/misc/mimportc.nim b/tests/misc/mimportc.nim
new file mode 100644
index 000000000..602c6372d
--- /dev/null
+++ b/tests/misc/mimportc.nim
@@ -0,0 +1,26 @@
+#[
+this test will grow with more importc+importcpp tests; see driver in trunner.nim
+]#
+
+{.emit:"""
+struct A {
+  static int fun0(int a){
+    return a;
+  }
+  static int& fun1(int& a){
+    return a;
+  }
+};
+""".}
+
+proc fun0*(a: cint): int {.importcpp:"A::$1(@)".}
+proc fun1*(a: var cint): var int {.importcpp:"A::$1(@)".} =
+  ## some comment; this test is for #14314
+  runnableExamples: discard
+
+proc main()=
+  var a = 10.cint
+  doAssert fun0(a) == a
+  doAssert fun1(a).addr == a.addr
+  echo "witness"
+main()