diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index 36c9b34a..a391fd5a 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -196,6 +196,24 @@ func AllowVirtual(mm CppMethod) bool { return true // AllowSignal(mm) } +func AllowVirtualForClass(className string) bool { + + // Allowing the subclassing of QAccessibleWidget compiles fine, + // but, always gives a linker error: + // + // /usr/lib/go-1.19/pkg/tool/linux_amd64/link: running g++ failed: exit status 1 + // /usr/bin/ld: /tmp/go-link-1745036494/000362.o: in function `MiqtVirtualQAccessibleWidget::MiqtVirtualQAccessibleWidget(QWidget*)': + // undefined reference to `vtable for MiqtVirtualQAccessibleWidget' + // + // An undefined vtable usually indicates that the virtual class is missing + // definitions for some virtual methods, but AFAICT we have complete coverage. + if className == "QAccessibleWidget" { + return false + } + + return true +} + func AllowMethod(className string, mm CppMethod) error { for _, p := range mm.Parameters { diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 2de8067c..d6c30637 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -413,16 +413,7 @@ func (c *CppClass) VirtualMethods() []CppMethod { return nil } - // FIXME Allowing the subclassing of QAccessibleWidget compiles fine, - // but, always gives a linker error: - // - // /usr/lib/go-1.19/pkg/tool/linux_amd64/link: running g++ failed: exit status 1 - // /usr/bin/ld: /tmp/go-link-1745036494/000362.o: in function `MiqtVirtualQAccessibleWidget::MiqtVirtualQAccessibleWidget(QWidget*)': - // undefined reference to `vtable for MiqtVirtualQAccessibleWidget' - // - // An undefined vtable usually indicates that the virtual class is missing - // definitions for some virtual methods, but AFAICT we have complete coverage. - if c.ClassName == "QAccessibleWidget" { + if !AllowVirtualForClass(c.ClassName) { return nil }