diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2023-11-16 10:38:35 +0100 |
|---|---|---|
| committer | Ivan Solovev <ivan.solovev@qt.io> | 2023-11-27 18:34:10 +0100 |
| commit | b3819d9cc200100bcf3fc30bcd3353c50cc73c4c (patch) | |
| tree | b259e2e8fe0fbdf9b938b27cfa13944591c3534e /src/corelib/global/qcompare.cpp | |
| parent | 9c03935c9a22f3f6baa602ec0ea7ce91f4a842f0 (diff) | |
Qt::*_ordering: use std::bit_cast when converting to std::_ordering
GCC, in particular, doesn't understand that the types are
fundamentally the same unless you compile with -O3, so help the
compiler by using bit_cast when it is available.
GCC now produces the same code at -O2 as previously only at -O3. Still
no tail-calls, though.
Task-number: QTBUG-118913
Change-Id: Ib1241a98f1de49c59a2e16b7d1f5cf813db4edf7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/global/qcompare.cpp')
| -rw-r--r-- | src/corelib/global/qcompare.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/src/corelib/global/qcompare.cpp b/src/corelib/global/qcompare.cpp index e02c78b6ae0..9275ff7a8ee 100644 --- a/src/corelib/global/qcompare.cpp +++ b/src/corelib/global/qcompare.cpp @@ -11,9 +11,6 @@ QT_BEGIN_NAMESPACE #ifdef __cpp_lib_three_way_comparison -static_assert(sizeof(std::partial_ordering) == sizeof(Qt::partial_ordering)); -static_assert(sizeof(std::weak_ordering) == sizeof(Qt::weak_ordering)); -static_assert(sizeof(std::strong_ordering) == sizeof(Qt::strong_ordering)); #ifdef __cpp_lib_bit_cast #define CHECK(type, flag) \ static_assert(std::bit_cast<Qt:: type ## _ordering>(std:: type ## _ordering:: flag) \ |
