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.

Pick-to: 6.8
Change-Id: I26979379b8fd12c3d52f6489fb25145ac2fa95ed
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Ivan Solovev 2024-08-27 18:17:41 +02:00 committed by Marc Mutz
parent 92e650832d
commit 31d3e57342

View File

@ -516,7 +516,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;
@ -527,7 +527,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);