From 567dc5c84e8877237258d47f9d917312ab001ce0 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Tue, 27 Aug 2024 18:17:41 +0200 Subject: [PATCH] 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 (cherry picked from commit 31d3e57342161a9a8edaebacb968950e6a16d67e) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qmetatype.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 1e944660c61..54e63f98871 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -521,7 +521,7 @@ public: static QMetaType fromName(QByteArrayView name); private: friend bool comparesEqual(const QMetaType &lhs, - const QMetaType &rhs) noexcept + const QMetaType &rhs) { if (lhs.d_ptr == rhs.d_ptr) return true; @@ -532,7 +532,7 @@ private: const int bId = rhs.id(); return aId == bId; } - Q_DECLARE_EQUALITY_COMPARABLE(QMetaType) + Q_DECLARE_EQUALITY_COMPARABLE_NON_NOEXCEPT(QMetaType) #ifndef QT_NO_DEBUG_STREAM private: friend Q_CORE_EXPORT QDebug operator<<(QDebug d, QMetaType m);