diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 9f4b7aa7cb..307d1f2e0e 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -774,7 +774,7 @@ proc getRecordDesc(m: BModule; typ: PType, name: Rope, result = structOrUnion & " " & name result.add(getRecordDescAux(m, typ, name, baseType, check, hasField)) let desc = getRecordFields(m, typ, check) - if not hasField: + if not hasField and typ.itemId notin m.g.graph.memberProcsPerType: if desc == "": result.add("\tchar dummy;\n") elif typ.len == 1 and typ.n[0].kind == nkSym: diff --git a/tests/cpp/tvirtual.nim b/tests/cpp/tvirtual.nim index 0488ce07de..7acec21baa 100644 --- a/tests/cpp/tvirtual.nim +++ b/tests/cpp/tvirtual.nim @@ -74,4 +74,8 @@ var val : int32 = 10 NimPrinter().printConstRef(message, val) NimPrinter().printConstRef2(message, val) +#bug 22269 +type Doo = object +proc naiveMember(x: Doo): int {. virtual .} = 2 +discard naiveMember(Doo())