genbindings: fix checking private methods of wrong class

This commit is contained in:
mappu 2025-01-19 17:06:58 +13:00
parent d3319cf273
commit 7e8f451e48

View File

@ -449,6 +449,10 @@ func (c *CppClass) VirtualMethods() []CppMethod {
retNames[m.CppCallTarget()] = struct{}{} retNames[m.CppCallTarget()] = struct{}{}
} }
for _, privMethod := range c.PrivateMethods {
block[privMethod] = struct{}{}
}
// Go will automatically allow virtual overrides for the base type because // Go will automatically allow virtual overrides for the base type because
// the parent struct is nested, but the resulting functions will not work // the parent struct is nested, but the resulting functions will not work
// because the C ABI dynamic_cast<> will fail for the base type. // because the C ABI dynamic_cast<> will fail for the base type.
@ -498,7 +502,7 @@ func (c *CppClass) VirtualMethods() []CppMethod {
// Append this parent's private-virtuals to blocklist so that we // Append this parent's private-virtuals to blocklist so that we
// do not consider them for grandparent classes // do not consider them for grandparent classes
for _, privMethod := range c.PrivateMethods { for _, privMethod := range cinfo.Class.PrivateMethods {
block[privMethod] = struct{}{} block[privMethod] = struct{}{}
} }
} }