summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJuan M Gómez <info@jmgomez.me>2023-09-18 07:26:21 +0100
committerGitHub <noreply@github.com>2023-09-18 08:26:21 +0200
commitbd857151d827c732f882c1fef52b91b5582ed65c (patch)
tree0ce11b7cb1612de07da196c5eaaa78a0a2eb51ab /tests
parent5f9038a5d76847ebb922dc34c3333879e8160426 (diff)
downloadNim-bd857151d827c732f882c1fef52b91b5582ed65c.tar.gz
prevents declaring a constructor without importcpp fixes #22712 (#22715)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/cpp/t22712.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/cpp/t22712.nim b/tests/cpp/t22712.nim
new file mode 100644
index 000000000..34ef67ac8
--- /dev/null
+++ b/tests/cpp/t22712.nim
@@ -0,0 +1,15 @@
+discard """
+targets: "cpp"
+errormsg: "constructor in an imported type needs importcpp pragma"
+line: 14
+"""
+{.emit: """/*TYPESECTION*/
+struct CppStruct {
+  CppStruct();
+};
+""".}
+
+type CppStruct {.importcpp.} = object
+
+proc makeCppStruct(): CppStruct {.constructor.} = 
+  discard
\ No newline at end of file