From bf9ba81429076002614e19620588da6ca6b8cfd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 21 Sep 2022 18:12:11 +0200 Subject: [PATCH] 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 --- src/corelib/global/qflags.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index a23dbb53cd..92bcb0df9c 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -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(qToUnderlying(lhs) op qToUnderlying(rhs)); } \ /* end */