From 9f13842fe61541cb8ab9822174ea963e418b5537 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Wed, 1 Sep 2021 15:33:13 +0200 Subject: 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 Pick-to: 6.2 6.1 Change-Id: Ia1e7240b4ce240c1c44f00ca680717d182df7550 Reviewed-by: Fabian Kosmale --- src/corelib/tools/qhash.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools/qhash.h') diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 38f23d822f..9145891faf 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -820,7 +820,7 @@ public: void swap(QHash &other) noexcept { qSwap(d, other.d); } template - QTypeTraits::compare_eq_result operator==(const QHash &other) const noexcept + QTypeTraits::compare_eq_result_container operator==(const QHash &other) const noexcept { if (d == other.d) return true; @@ -836,7 +836,7 @@ public: return true; } template - QTypeTraits::compare_eq_result operator!=(const QHash &other) const noexcept + QTypeTraits::compare_eq_result_container operator!=(const QHash &other) const noexcept { return !(*this == other); } inline qsizetype size() const noexcept { return d ? qsizetype(d->size) : 0; } -- cgit v1.2.3