From ff004175bcd5dc23f8c080cd390b04117c9f51df Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 26 Feb 2012 23:01:46 +0100 Subject: QFlags: mark as Q_PRIMITIVE_TYPE I originally tried to put Q_DECLARE_TYPEINFOs into Q_DECLARE_OPERATORS_FOR_FLAGS, to declare not only the flags type, but also the underlying enum as primitive, but too many users (arguably correctly) used Q_DECLARE_OPERATORS_FOR_FLAGS at (non-global) namespace scope where QTypeInfo would have been specialised in the wrong namespace. So specialise QTypeInfo for QFlags only. Change-Id: I4af6e29aefbd9460a3d2bc6405f03cdf6b1096bc Reviewed-by: Thiago Macieira Reviewed-by: Stephen Kelly Reviewed-by: Olivier Goffart --- tests/auto/corelib/global/qflags/tst_qflags.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/corelib/global/qflags') diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp index d466d7b8d8..2794c174ba 100644 --- a/tests/auto/corelib/global/qflags/tst_qflags.cpp +++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp @@ -123,6 +123,15 @@ void tst_QFlags::constExpr() #endif } +// (statically) check QTypeInfo for QFlags instantiations: +enum MyEnum { Zero, One, Two, Four=4 }; +Q_DECLARE_FLAGS( MyFlags, MyEnum ); +Q_DECLARE_OPERATORS_FOR_FLAGS( MyFlags ); + +Q_STATIC_ASSERT( !QTypeInfo::isComplex ); +Q_STATIC_ASSERT( !QTypeInfo::isStatic ); +Q_STATIC_ASSERT( !QTypeInfo::isLarge ); +Q_STATIC_ASSERT( !QTypeInfo::isPointer ); QTEST_MAIN(tst_QFlags) #include "tst_qflags.moc" -- cgit v1.2.3