diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index c4cd623d9b..9295b873c8 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -2351,7 +2351,7 @@ proc semCppMember(c: PContext; s: PSym; n: PNode) = isInitializer = false break var j = 0 - while p[j].sym.kind == skParam: + while p[j].kind == nkSym and p[j].sym.kind == skParam: initializerCall.add val inc j if isInitializer: diff --git a/tests/cpp/tconstructor.nim b/tests/cpp/tconstructor.nim index 922ee54fd4..2076b15d8d 100644 --- a/tests/cpp/tconstructor.nim +++ b/tests/cpp/tconstructor.nim @@ -128,4 +128,10 @@ block: var b = makeBoo() var b2 = makeBoo2() - main() \ No newline at end of file + main() + +block: # bug #24658 + type + A {.importcpp: "A".} = object + + proc a(something: ptr cint = nil): A {.cdecl, constructor, importcpp: "A(@)".}