diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index 92bcb0df9c0..c791c26ac1f 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -179,26 +179,35 @@ typedef QFlags Flags; // These are opt-in, for backwards compatibility #define QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags) \ +[[maybe_unused]] \ constexpr inline Flags operator~(Flags::enum_type e) noexcept \ { return ~Flags(e); } \ +[[maybe_unused]] \ constexpr inline void operator|(Flags::enum_type f1, int f2) noexcept = delete; #else #define QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags) \ +[[maybe_unused]] \ constexpr inline QIncompatibleFlag operator|(Flags::enum_type f1, int f2) noexcept \ { return QIncompatibleFlag(int(f1) | f2); } #endif #define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ +[[maybe_unused]] \ constexpr inline QFlags operator|(Flags::enum_type f1, Flags::enum_type f2) noexcept \ { return QFlags(f1) | f2; } \ +[[maybe_unused]] \ constexpr inline QFlags operator|(Flags::enum_type f1, QFlags f2) noexcept \ { return f2 | f1; } \ +[[maybe_unused]] \ constexpr inline QFlags operator&(Flags::enum_type f1, Flags::enum_type f2) noexcept \ { return QFlags(f1) & f2; } \ +[[maybe_unused]] \ constexpr inline QFlags operator&(Flags::enum_type f1, QFlags f2) noexcept \ { return f2 & f1; } \ +[[maybe_unused]] \ constexpr inline QFlags operator^(Flags::enum_type f1, Flags::enum_type f2) noexcept \ { return QFlags(f1) ^ f2; } \ +[[maybe_unused]] \ constexpr inline QFlags operator^(Flags::enum_type f1, QFlags f2) noexcept \ { return f2 ^ f1; } \ constexpr inline void operator+(Flags::enum_type f1, Flags::enum_type f2) noexcept = delete; \