From 13cfa3c88be220dbb732975bd76d19dfa70c4469 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 28 Feb 2017 09:51:26 +0100 Subject: Clean-up QRgba64 constructors We can add basic constructors now on all supported platforms, and can make initialization consistent on all platforms, choosing undefined as the default. Note this changes behavior on gcc and clang builds, but is consistent with pre-c++11 gcc and clang builds and with msvc. [ChangeLog][QtGui][QRgba64] The default constructor on Clang and GCC builds now no longer initializes with 0s, but leaves the value uninitialized. This is consistent with MSVC behavior and pre-C++11 behavior of GCC and Clang. Change-Id: Ib0e3d7f4274a13a768db62931b67877e3898945e Reviewed-by: Marc Mutz --- src/gui/painting/qrgba64.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/gui/painting/qrgba64.h') diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h index a3ae0c9b14..2c8f8fa8c4 100644 --- a/src/gui/painting/qrgba64.h +++ b/src/gui/painting/qrgba64.h @@ -64,26 +64,14 @@ class QRgba64 { #endif }; - // No constructors are allowed in C++98, since this needs to be usable in a union. - // We however require one for constexprs in C++11/C++14 -#ifdef Q_COMPILER_CONSTEXPR explicit Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64(quint64 c) : rgba(c) { } -#endif public: -#ifdef Q_COMPILER_CONSTEXPR - Q_ALWAYS_INLINE Q_DECL_CONSTEXPR QRgba64() : rgba(0) { } -#endif + QRgba64() = default; Q_DECL_CONSTEXPR static QRgba64 fromRgba64(quint64 c) { -#ifdef Q_COMPILER_CONSTEXPR return QRgba64(c); -#else - QRgba64 rgba64; - rgba64.rgba = c; - return rgba64; -#endif } Q_DECL_CONSTEXPR static QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha) -- cgit v1.2.3