From 8705ac0b5c840e0dc8dc7e04ec4f933619cc0e75 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 19 Jan 2025 16:38:55 +1300 Subject: [PATCH] genbindings: expand virtual overrides to cover indirect base classes --- cmd/genbindings/intermediate.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 1036b2d6..9cced1ec 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -449,10 +449,11 @@ func (c *CppClass) VirtualMethods() []CppMethod { retNames[m.CppCallTarget()] = struct{}{} } - // Only allow virtual overrides for direct inherits, not all inherits - // Go will automatically allow virtual overrides for the base type because - // the parent struct is nested - for _, cinfo := range c.DirectInheritClassInfo() { + // the parent struct is nested, but the resulting functions will not work + // because the C ABI dynamic_cast<> will fail for the base type. + // Scan all inherited classes + for _, cinfo := range c.AllInheritsClassInfo() { // If a base class is permanently unprojectable, the child classes // should be too