QFlags: Mark the mixed enum operator declared in macro maybe_unused

Because, when used in a .cpp file, the compiler can verify that
it is. With warnings-are-errors this can break compilation.

Pick-to: 6.4 6.2
Change-Id: I2c403d914fca24158dba93f618476521cbcfe39f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Mårten Nordheim 2022-09-21 18:12:11 +02:00
parent b61e9846d3
commit bf9ba81429
1 changed files with 1 additions and 0 deletions

View File

@ -218,6 +218,7 @@ QT_DECLARE_TYPESAFE_OPERATORS_FOR_FLAGS_ENUM(Flags)
#if __cplusplus > 201702L // assume compilers don't warn if in C++17 mode
// in C++20 mode, provide user-defined operators to override the deprecated operations:
# define Q_DECLARE_MIXED_ENUM_OPERATOR(op, Ret, LHS, RHS) \
[[maybe_unused]] \
constexpr inline Ret operator op (LHS lhs, RHS rhs) noexcept \
{ return static_cast<Ret>(qToUnderlying(lhs) op qToUnderlying(rhs)); } \
/* end */