Skip to content

Commit

Permalink
QFlags: Mark the mixed enum operator declared in macro maybe_unused
Browse files Browse the repository at this point in the history
Because, when used in a .cpp file, the compiler can verify that
it is. With warnings-are-errors this can break compilation.

Change-Id: I2c403d914fca24158dba93f618476521cbcfe39f
Reviewed-by: Thiago Macieira <[email protected]>
(cherry picked from commit bf9ba81)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
Morten242 authored and Qt Cherry-pick Bot committed Sep 23, 2022
1 parent 617e1fe commit 6310874
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/corelib/global/qflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 6310874

Please sign in to comment.