summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-04-09 14:14:21 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-08-10 03:41:43 +0000
commit3bf4c222e5f8f3a4044befb8d784afea598946cc (patch)
tree1b6397694c085f0ea487b7608f150a4fee344ea8 /src/corelib/global
parentd9d9420d8d637064b9a5cc25ea91d96767b31a85 (diff)
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<Custom> vector(5, Qt::Uninitialized); which is actually implicitly: QVector<Custom> vector(5, Custom(Qt::Uninitialized)); and likely not what the developer wanted. Change-Id: I27eaacb532114dd188c4ffff13d374eb698bfbab Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qnamespace.h7
1 files changed, 7 insertions, 0 deletions
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,