From 8ccc5c6c8f8dcf3f7bdac302e38a2af3991a2be5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 16 Apr 2024 14:48:27 +0300 Subject: [PATCH] "constexpr" literal operators should be "consteval". --- src/libs/vmisc/compatibility.h | 4 ++-- src/libs/vmisc/defglobal.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/vmisc/compatibility.h b/src/libs/vmisc/compatibility.h index 356f692a1..79f6d0aba 100644 --- a/src/libs/vmisc/compatibility.h +++ b/src/libs/vmisc/compatibility.h @@ -67,13 +67,13 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wreserved-identifier") //--------------------------------------------------------------------------------------------------------------------- -Q_DECL_CONSTEXPR inline auto operator""_L1(char ch)Q_DECL_NOEXCEPT->QLatin1Char +Q_DECL_CONSTEVAL inline auto operator""_L1(char ch)Q_DECL_NOEXCEPT->QLatin1Char { return QLatin1Char(ch); } //--------------------------------------------------------------------------------------------------------------------- -Q_DECL_CONSTEXPR inline auto operator""_L1(const char *str, size_t size)Q_DECL_NOEXCEPT->QLatin1String +Q_DECL_CONSTEVAL inline auto operator""_L1(const char *str, size_t size)Q_DECL_NOEXCEPT->QLatin1String { return QLatin1String(str, static_cast(size)); } diff --git a/src/libs/vmisc/defglobal.h b/src/libs/vmisc/defglobal.h index 216f9e0a4..2631f6449 100644 --- a/src/libs/vmisc/defglobal.h +++ b/src/libs/vmisc/defglobal.h @@ -59,4 +59,10 @@ class QTextCodec; using VTextCodec = QTextCodec; #endif +#if __cplusplus >= 202002L && defined(__cpp_consteval) && __cpp_consteval >= 201811L +#define Q_DECL_CONSTEVAL consteval +#else +#define Q_DECL_CONSTEVAL constexpr +#endif + #endif // DEFGLOBAL_H