prevents declaring a constructor without importcpp fixes #22712 (#22715)

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Juan M Gómez
2023-09-18 07:26:21 +01:00
committed by GitHub
parent 5f9038a5d7
commit bd857151d8
2 changed files with 22 additions and 2 deletions

15
tests/cpp/t22712.nim Normal file
View File

@@ -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