diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 1e2a860d8c..b854dc16fd 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -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 { enum { Value = false }; }; QT_WARNING_POP template diff --git a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp index 17b00ebf63..5a10cf51e6 100644 --- a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp +++ b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp @@ -91,5 +91,13 @@ void tst_QMetaEnum::valuesToKeys() QCOMPARE(me.valueToKeys(windowFlags), expected); } +Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper::Value); +Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper::Value); +Q_STATIC_ASSERT(QtPrivate::IsQEnumHelper::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper::Value); +Q_STATIC_ASSERT(!QtPrivate::IsQEnumHelper::Value); + QTEST_MAIN(tst_QMetaEnum) #include "tst_qmetaenum.moc"