Fixes Naive virtual crash the compiler fixes #22269 (#22271)

* Fixes Naive virtual crash the compiler fixes #22269

* adds type specific test
This commit is contained in:
Juan M Gómez
2023-07-16 16:01:34 +01:00
committed by GitHub
parent f9280090f6
commit 50d435cd39
2 changed files with 5 additions and 1 deletions

View File

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

View File

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