From 3bf4c222e5f8f3a4044befb8d784afea598946cc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 9 Apr 2015 14:14:21 -0700 Subject: Make Qt::Initialization a C++11 class enum And declare Qt::Uninitialized to be the same value because we're not interested in the scoping rules of C++11 class enums. We're only interested in avoiding the cast from Qt::Uninitialized to an integer. That is to avoid the mistaken: QVector vector(5, Qt::Uninitialized); which is actually implicitly: QVector vector(5, Custom(Qt::Uninitialized)); and likely not what the developer wanted. Change-Id: I27eaacb532114dd188c4ffff13d374eb698bfbab Reviewed-by: Marc Mutz --- src/corelib/global/qnamespace.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 3e3af6ede3..de8a17fa51 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1536,9 +1536,16 @@ public: TitleBarArea // For move }; +#if defined(Q_COMPILER_CLASS_ENUM) && defined(Q_COMPILER_CONSTEXPR) + enum class Initialization { + Uninitialized + }; + static constexpr Q_DECL_UNUSED Initialization Uninitialized = Initialization::Uninitialized; +#else enum Initialization { Uninitialized }; +#endif enum CoordinateSystem { DeviceCoordinates, -- cgit v1.2.3