From 53049d60277e0168a6c9f514674f26f9c25df84b Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 2 May 2021 00:54:51 +0200 Subject: QFlags: plaster Q_IMPLICIT Change-Id: Ic56a32d354e6868f2e01771975c00509a9d91296 Reviewed-by: Thiago Macieira --- src/corelib/global/qflags.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index 0e20f88c9c..8fb6cb09a3 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -52,21 +52,21 @@ class QFlag { int i; public: - constexpr inline QFlag(int value) noexcept : i(value) {} - constexpr inline operator int() const noexcept { return i; } + constexpr inline Q_IMPLICIT QFlag(int value) noexcept : i(value) {} + constexpr inline Q_IMPLICIT operator int() const noexcept { return i; } #if !defined(Q_CC_MSVC) // Microsoft Visual Studio has buggy behavior when it comes to // unsigned enums: even if the enum is unsigned, the enum tags are // always signed # if !defined(__LP64__) && !defined(Q_CLANG_QDOC) - constexpr inline QFlag(long value) noexcept : i(int(value)) {} - constexpr inline QFlag(ulong value) noexcept : i(int(long(value))) {} + constexpr inline Q_IMPLICIT QFlag(long value) noexcept : i(int(value)) {} + constexpr inline Q_IMPLICIT QFlag(ulong value) noexcept : i(int(long(value))) {} # endif - constexpr inline QFlag(uint value) noexcept : i(int(value)) {} - constexpr inline QFlag(short value) noexcept : i(int(value)) {} - constexpr inline QFlag(ushort value) noexcept : i(int(uint(value))) {} - constexpr inline operator uint() const noexcept { return uint(i); } + constexpr inline Q_IMPLICIT QFlag(uint value) noexcept : i(int(value)) {} + constexpr inline Q_IMPLICIT QFlag(short value) noexcept : i(int(value)) {} + constexpr inline Q_IMPLICIT QFlag(ushort value) noexcept : i(int(uint(value))) {} + constexpr inline Q_IMPLICIT operator uint() const noexcept { return uint(i); } #endif }; Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE); @@ -76,7 +76,7 @@ class QIncompatibleFlag int i; public: constexpr inline explicit QIncompatibleFlag(int i) noexcept; - constexpr inline operator int() const noexcept { return i; } + constexpr inline Q_IMPLICIT operator int() const noexcept { return i; } }; Q_DECLARE_TYPEINFO(QIncompatibleFlag, Q_PRIMITIVE_TYPE); @@ -106,8 +106,8 @@ public: typedef Enum enum_type; // compiler-generated copy/move ctor/assignment operators are fine! constexpr inline QFlags() noexcept : i(0) {} - constexpr inline QFlags(Enum flags) noexcept : i(Int(flags)) {} - constexpr inline QFlags(QFlag flag) noexcept : i(flag) {} + constexpr inline Q_IMPLICIT QFlags(Enum flags) noexcept : i(Int(flags)) {} + constexpr inline Q_IMPLICIT QFlags(QFlag flag) noexcept : i(flag) {} constexpr inline QFlags(std::initializer_list flags) noexcept : i(initializer_list_helper(flags.begin(), flags.end())) {} -- cgit v1.2.3