Fix QtPrivate::IsQEnumHelper<void>

Change-Id: I1633ef128212a6b99b66129f13e0b4d5ea46644d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Olivier Goffart 2015-05-16 12:21:22 +02:00 committed by Olivier Goffart (Woboq GmbH)
parent 298a60d958
commit 35a125971c
2 changed files with 9 additions and 0 deletions

View File

@ -1381,6 +1381,7 @@ QT_WARNING_DISABLE_CLANG("-Wlocal-type-template-args")
// qt_getEnumMetaObject(T) which returns 'char'
enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) };
};
template<> struct IsQEnumHelper<void> { enum { Value = false }; };
QT_WARNING_POP
template<typename T, typename Enable = void>

View File

@ -91,5 +91,13 @@ void tst_QMetaEnum::valuesToKeys()
QCOMPARE(me.valueToKeys(windowFlags), expected);
}
Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<tst_QMetaEnum::SuperEnum>::Value);
Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<Qt::WindowFlags>::Value);
Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper<Qt::Orientation>::Value);
Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<int>::Value);
Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<QObject>::Value);
Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<QObject*>::Value);
Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper<void>::Value);
QTEST_MAIN(tst_QMetaEnum)
#include "tst_qmetaenum.moc"