PyQt6 build issues with GCC 16, related to operator!=

Dmitry Shachnev mitya57 at ubuntu.com
Tue Aug 11 21:37:15 BST 2026


On Tue, Aug 11, 2026 at 08:45:32PM +0100, Phil Thompson wrote:
> > I think if we use normal comparison (a != b) instead of explicitly calling
> > the operator (operator!=(a, b)), then it should work fine. Can SIP
> > generate that?
>
> That's what SIP used to do many, many years ago. I think it changed to
> support virtual operators where you need to be able to specify a scope to
> make sure the right implementation of the operator is called. However the
> problematic operators we know about are defined outside the scope of a class
> so I'll change SIP to generate normal comparisons for that subset.

I just did a quick test, and confirmed that normal comparison will work.

The attached file fails to compile with:

    $ g++ -c -std=c++20 $(pkg-config --cflags Qt6Core) test.cpp
    test.cpp: In function ‘bool inequal(QLocale::Language, const QLocale&)’:
    test.cpp:5:12: error: ‘operator!=’ not defined
        5 |     return operator!=(lang, loc);
          |            ^~~~~~~~~~

But if you comment line 5 and uncomment line 6, then it compiles fine.

--
Dmitry Shachnev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 142 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20260811/ab4c4691/attachment.cpp>


More information about the PyQt mailing list