diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2021-09-01 15:33:13 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-07 16:00:08 +0000 |
commit | c315583a82eac39bce6feb0f5f4d4f6036b01611 (patch) | |
tree | 82c55f8448ba41f04e35ff175beb13cde72b9780 /src/corelib/tools/qmap.h | |
parent | 8f52022bbdd6aae40539191ce9db8b87328fe5b6 (diff) |
Fix compilation for recursive Qt containers
The operator checks cause compilation errors when trying to check for
their existence for recursive containers. This happens because of trying
to check for the operators on the template parameter type(s), that
inherit from the container itself, which leads to compilation errors.
Introduced alternative versions of the operator checks (with _container
suffix), that first check if the container is recursive, i.e. any of its
template parameter types inherits from the given container, and skips
the operator check, if that's the case.
The fix is done for all Qt container types that had the problem, except
for QVarLengthArray and QContiguousCache, which don't compile with
recursive parameter types for unrelated reasons.
Fixes: QTBUG-91707
Change-Id: Ia1e7240b4ce240c1c44f00ca680717d182df7550
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9f13842fe61541cb8ab9822174ea963e418b5537)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/tools/qmap.h')
-rw-r--r-- | src/corelib/tools/qmap.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index d5f6b91ba8..57a964f29f 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -277,7 +277,7 @@ public: } template <typename AKey = Key, typename AT = T> friend - QTypeTraits::compare_eq_result<AKey, AT> operator==(const QMap &lhs, const QMap &rhs) + QTypeTraits::compare_eq_result_container<QMap, AKey, AT> operator==(const QMap &lhs, const QMap &rhs) { if (lhs.d == rhs.d) return true; @@ -288,7 +288,7 @@ public: } template <typename AKey = Key, typename AT = T> friend - QTypeTraits::compare_eq_result<AKey, AT> operator!=(const QMap &lhs, const QMap &rhs) + QTypeTraits::compare_eq_result_container<QMap, AKey, AT> operator!=(const QMap &lhs, const QMap &rhs) { return !(lhs == rhs); } @@ -905,7 +905,7 @@ public: } template <typename AKey = Key, typename AT = T> friend - QTypeTraits::compare_eq_result<AKey, AT> operator==(const QMultiMap &lhs, const QMultiMap &rhs) + QTypeTraits::compare_eq_result_container<QMultiMap, AKey, AT> operator==(const QMultiMap &lhs, const QMultiMap &rhs) { if (lhs.d == rhs.d) return true; @@ -916,7 +916,7 @@ public: } template <typename AKey = Key, typename AT = T> friend - QTypeTraits::compare_eq_result<AKey, AT> operator!=(const QMultiMap &lhs, const QMultiMap &rhs) + QTypeTraits::compare_eq_result_container<QMultiMap, AKey, AT> operator!=(const QMultiMap &lhs, const QMultiMap &rhs) { return !(lhs == rhs); } |