diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index fb4b3f3198..ecbdfe4fb8 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -831,8 +831,8 @@ public: void swap(QHash &other) noexcept { qSwap(d, other.d); } #ifndef Q_CLANG_QDOC - template - QTypeTraits::compare_eq_result_container operator==(const QHash &other) const noexcept + template + QTypeTraits::compare_eq_result_container operator==(const QHash &other) const noexcept { if (d == other.d) return true; @@ -847,8 +847,8 @@ public: // all values must be the same as size is the same return true; } - template - QTypeTraits::compare_eq_result_container operator!=(const QHash &other) const noexcept + template + QTypeTraits::compare_eq_result_container operator!=(const QHash &other) const noexcept { return !(*this == other); } #else bool operator==(const QHash &other) const; @@ -1306,7 +1306,9 @@ public: } void swap(QMultiHash &other) noexcept { qSwap(d, other.d); qSwap(m_size, other.m_size); } - bool operator==(const QMultiHash &other) const noexcept +#ifndef Q_CLANG_QDOC + template + QTypeTraits::compare_eq_result_container operator==(const QMultiHash &other) const noexcept { if (d == other.d) return true; @@ -1339,7 +1341,13 @@ public: // all values must be the same as size is the same return true; } - bool operator!=(const QMultiHash &other) const noexcept { return !(*this == other); } + template + QTypeTraits::compare_eq_result_container operator!=(const QMultiHash &other) const noexcept + { return !(*this == other); } +#else + bool operator==(const QMultiHash &other) const; + bool operator!=(const QMultiHash &other) const; +#endif // Q_CLANG_QDOC inline qsizetype size() const noexcept { return m_size; } diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index 80d1d90f2a..d4551785e9 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -253,11 +253,9 @@ Q_DECLARE_METATYPE(NoCmpParamRecursiveMapK); Q_DECLARE_METATYPE(NoCmpParamRecursiveMultiMapV); Q_DECLARE_METATYPE(NoCmpParamRecursiveMultiMapK); Q_DECLARE_METATYPE(NoCmpParamRecursiveHashK); -// TODO: fix, this requires operator== from key type (QTBUG-96256) -// Q_DECLARE_METATYPE(NoCmpParamRecursiveHashV); +Q_DECLARE_METATYPE(NoCmpParamRecursiveHashV); Q_DECLARE_METATYPE(NoCmpParamRecursiveMultiHashK); -// TODO: fix, this requires operator== from key type (QTBUG-96256) -// Q_DECLARE_METATYPE(NoCmpParamRecursiveMultiHashK); +Q_DECLARE_METATYPE(NoCmpParamRecursiveMultiHashV); Q_DECLARE_METATYPE(NoCmpRecursiveList); // TODO: fix, this requires operator== (QTBUG-96257) @@ -287,9 +285,9 @@ static_assert(!QTypeTraits::has_operator_equal_v); static_assert(!QTypeTraits::has_operator_equal_v); static_assert(!QTypeTraits::has_operator_equal_v); static_assert(!QTypeTraits::has_operator_equal_v); -static_assert(QTypeTraits::has_operator_equal_v); +static_assert(!QTypeTraits::has_operator_equal_v); static_assert(!QTypeTraits::has_operator_equal_v); -static_assert(QTypeTraits::has_operator_equal_v); +static_assert(!QTypeTraits::has_operator_equal_v); static_assert(!QTypeTraits::has_operator_equal_v); static_assert(!QTypeTraits::has_operator_equal_v);