PyQt6 build issues with GCC 16, related to operator!=
Phil Thompson
phil at riverbankcomputing.com
Tue Aug 11 20:45:32 BST 2026
On 11/08/2026 20:04, Dmitry Shachnev wrote:
> Hi Phil!
>
> On Tue, Aug 11, 2026 at 04:25:04PM +0100, Phil Thompson wrote:
>> A C++ expert could probably help...
>>
>> - the generated code has been working fine for years and years and
>> still
>> does with other compilers and older versions of GCC
>> - the problems only seem to be with operator!= and not operator==
>> - GCC v16 defaults to -std=c++20
>>
>> The QLocale code expects the corresponding convertor ctor to be
>> invoked
>> automatically. I've changed the code (tonight's snapshot) to call the
>> ctor
>> explicitly - see if that improves things.
>>
>> I am at a loss with the QWebEngineFrame code which doesn't use any
>> implicit
>> conversions. I've tried building with clang++ with -std=c++20 - no
>> problems.
>
> It looks like the snapshot is not published yet, so I will test it
> later.
Given what you say below I think it will fail as well.
> You are right, this problem looks related to C++20, in particular with
> the new comparison system:
> <https://www.qt.io/blog/c20-comparisons-in-qt>.
>
> That blog post says:
>
>> comparesEqual() is used to implement operator==() in C++20 and also
>> operator!=() in C++17.
>
> So if I understand it correctly, there is no explicit operator!= with
> C++20
> anymore, only the <=> operator.
>
> 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.
Phil
More information about the PyQt
mailing list