QMetaType: remove the incorrect noexcept from comparison operators

The implementation calls QMetaType::id(), which may call
registerHelper() to register a custom type, and that surely allocates.

Amends 5a0faa9198c6ae6e21a550159c4284d1a9c5792e.

Found in 6.8 API Review.

Change-Id: I26979379b8fd12c3d52f6489fb25145ac2fa95ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 31d3e57342161a9a8edaebacb968950e6a16d67e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ivan Solovev 2024-08-27 18:17:41 +02:00 committed by Qt Cherry-pick Bot
parent e86c5bf71c
commit 567dc5c84e

View File

@ -521,7 +521,7 @@ public:
static QMetaType fromName(QByteArrayView name); static QMetaType fromName(QByteArrayView name);
private: private:
friend bool comparesEqual(const QMetaType &lhs, friend bool comparesEqual(const QMetaType &lhs,
const QMetaType &rhs) noexcept const QMetaType &rhs)
{ {
if (lhs.d_ptr == rhs.d_ptr) if (lhs.d_ptr == rhs.d_ptr)
return true; return true;
@ -532,7 +532,7 @@ private:
const int bId = rhs.id(); const int bId = rhs.id();
return aId == bId; return aId == bId;
} }
Q_DECLARE_EQUALITY_COMPARABLE(QMetaType) Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QMetaType)
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM
private: private:
friend Q_CORE_EXPORT QDebug operator<<(QDebug d, QMetaType m); friend Q_CORE_EXPORT QDebug operator<<(QDebug d, QMetaType m);