From 6255cb893d411b055758f2e64e94fde0bce91ea8 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 3 Nov 2016 16:08:55 +0000 Subject: Remove qtypetraits.h's contents altogether So that QFlags can use an (un)signed int matching the underlying type as identified by the compiler and not by us. Requires fixing a few warnings about sign conversion due to QFlags misusages in qtbase that were either plain wrong, or were relying on the enum being backed by an (un)signed int when it wasn't. Keep qtypetraits.h in the source tree in order to prevent source breaks if some downstream #includes it (note however that it did not contain any public API). Change-Id: Ib3a92b98db7031e793a088fb2a3b306eff4d7a3c Reviewed-by: Thiago Macieira --- src/corelib/global/qflags.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/corelib/global/qflags.h') diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index b871c90c9d..89a0ae9083 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -42,13 +42,12 @@ #ifndef QFLAGS_H #define QFLAGS_H -#include -#include - #ifdef Q_COMPILER_INITIALIZER_LISTS #include #endif +#include + QT_BEGIN_NAMESPACE class QFlag @@ -94,6 +93,8 @@ class QFlags Q_STATIC_ASSERT_X((sizeof(Enum) <= sizeof(int)), "QFlags uses an int as storage, so an enum with underlying " "long long will overflow."); + Q_STATIC_ASSERT_X((std::is_enum::value), "QFlags is only usable on enumeration types."); + struct Private; typedef int (Private::*Zero); public: @@ -103,7 +104,7 @@ public: typedef int Int; #else typedef typename std::conditional< - QtPrivate::QIsUnsignedEnum::value, + std::is_unsigned::type>::value, unsigned int, signed int >::type Int; -- cgit v1.2.3