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 <type_traits>, 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) <ogoffart@woboq.com>
bb10
Marc Mutz 2017-02-20 13:50:35 +01:00
parent 19085350fb
commit 7c647edae9
2 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ public:
enum {
isPointer = false,
isIntegral = std::is_integral<T>::value,
isComplex = true,
isComplex = !isIntegral && !std::is_enum<T>::value,
isStatic = true,
isRelocatable = std::is_enum<T>::value,
isLarge = (sizeof(T)>sizeof(void*)),

View File

@ -731,7 +731,7 @@ QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW)
QTest::newRow("QPair<P,C>") << ::qMetaTypeId<QPair<P,C> >() << false << true << false << false;
QTest::newRow("QPair<P,M>") << ::qMetaTypeId<QPair<P,M> >() << true << true << false << false;
QTest::newRow("QPair<P,P>") << ::qMetaTypeId<QPair<P,P> >() << true << false << false << false;
QTest::newRow("FlagsDataEnum") << ::qMetaTypeId<FlagsDataEnum>() << true << true << false << true;
QTest::newRow("FlagsDataEnum") << ::qMetaTypeId<FlagsDataEnum>() << true << false << false << true;
// invalid ids.
QTest::newRow("-1") << -1 << false << false << false << false;