mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 22:35:24 +00:00
actually fixes #21889
This commit is contained in:
24
tests/cpp/tconstructor.nim
Normal file
24
tests/cpp/tconstructor.nim
Normal file
@@ -0,0 +1,24 @@
|
||||
discard """
|
||||
targets: "cpp"
|
||||
cmd: "nim cpp $file"
|
||||
"""
|
||||
|
||||
{.emit:"""/*TYPESECTION*/
|
||||
struct CppClass {
|
||||
int x;
|
||||
int y;
|
||||
CppClass(int inX, int inY) {
|
||||
this->x = inX;
|
||||
this->y = inY;
|
||||
}
|
||||
//CppClass() = default;
|
||||
};
|
||||
""".}
|
||||
|
||||
type CppClass* {.importcpp.} = object
|
||||
x: int32
|
||||
y: int32
|
||||
|
||||
proc makeCppClass(x, y: int32): CppClass {.importcpp: "CppClass(@)", constructor.}
|
||||
|
||||
var shouldCompile = makeCppClass(1, 2)
|
||||
Reference in New Issue
Block a user