From 7c647edae928d27343b64b5e0f0805920b754110 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 20 Feb 2017 13:50:35 +0100 Subject: [PATCH] QTypeInfo: don't treat enums and (extended) integral types as complex We fully specialize QTypeInfo for most C++ built-in types, but enums and extended integral types (like GCC's int128_t) were not covered. Now that we depend on , we can stop pessimizing enums and extended integral types in QVector and QVLA by defaulting QTypeInfo::isComplex to true for such types. Fix a test that checked that enums were complex types. This should have been a XFAIL test. Enums are not complex types. Change-Id: Ibb0fb38cc83e980a428b5573d1db5666593418ae Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qtypeinfo.h | 2 +- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 53f6b3fff6..cbba253a75 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -60,7 +60,7 @@ public: enum { isPointer = false, isIntegral = std::is_integral::value, - isComplex = true, + isComplex = !isIntegral && !std::is_enum::value, isStatic = true, isRelocatable = std::is_enum::value, isLarge = (sizeof(T)>sizeof(void*)), diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 7d9f56ef38..e3c810984c 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -731,7 +731,7 @@ QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW) QTest::newRow("QPair") << ::qMetaTypeId >() << false << true << false << false; QTest::newRow("QPair") << ::qMetaTypeId >() << true << true << false << false; QTest::newRow("QPair") << ::qMetaTypeId >() << true << false << false << false; - QTest::newRow("FlagsDataEnum") << ::qMetaTypeId() << true << true << false << true; + QTest::newRow("FlagsDataEnum") << ::qMetaTypeId() << true << false << false << true; // invalid ids. QTest::newRow("-1") << -1 << false << false << false << false;