summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qmetatype
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-03-23 22:29:53 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-03-25 11:22:29 +0100
commitce83e56cfeb2806181ec1daade9690f4c90b901c (patch)
tree11fb35a913320f8fb4ce7d007118bbe407e84c7a /tests/auto/corelib/kernel/qmetatype
parentf1eccab04e01b3acc1a4b4c6a5fe7b3af3e2dcba (diff)
QTypeInfo: Handle T::value_type being equal to T
Fix operator checks for containers whose value_type equals themselves. It does not make sense to recurse on value_type in that case. Thanks to std::disjunction having short-circuiting semantics, we can avoid that issue by checking first whether T is T::value_type. As a drive-by, check for value_type typedef before checking for begin/end in is_container. This works around an issue in gcc <= 8.1, which fails to correctly SFINAE the case where begin and end are private methods. Pick-to: 6.0 6.1 Fixes: QTBUG-89456 Change-Id: I27305a7cfe050f13a279c07f00bc229c01daa25b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel/qmetatype')
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index df9beabe73..09a5125886 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -2128,5 +2128,15 @@ void tst_QMetaType::constexprMetaTypeIds()
Q_UNUSED(metaType);
}
+struct S {
+ using value_type = S; // used to cause compilation error with Qt6
+ int begin();
+ int end();
+};
+
+// should not cause a compilation failure
+// used to cause issues due to S being equal to S::value_type
+Q_DECLARE_METATYPE(S)
+
QTEST_MAIN(tst_QMetaType)
#include "tst_qmetatype.moc"