From 96bd9242acac77925e9b8f8897b877824ae5e5e1 Mon Sep 17 00:00:00 2001 From: Matthias Moulin Date: Sun, 7 Apr 2024 14:12:29 +0200 Subject: [PATCH] Resolved FMT_USE_CONSTEVAL for MSVC --- include/fmt/base.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index a249673f2ecd..f571ed9987bd 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -109,10 +109,14 @@ #endif // Detect consteval, C++20 constexpr extensions and std::is_constant_evaluated. -#if !defined(__cpp_lib_is_constant_evaluated) +// DIVERGENCE BEGIN - Resolved FMT_USE_CONSTEVAL for MSVC +#if FMT_CPLUSPLUS < 201709L # define FMT_USE_CONSTEVAL 0 -#elif FMT_CPLUSPLUS < 201709L +#elif FMT_MSC_VERSION && FMT_MSC_VERSION >= 1929 +# define FMT_USE_CONSTEVAL 1 +#elif !defined(__cpp_lib_is_constant_evaluated) # define FMT_USE_CONSTEVAL 0 +// DIVERGENCE END #elif FMT_GLIBCXX_RELEASE && FMT_GLIBCXX_RELEASE < 10 # define FMT_USE_CONSTEVAL 0 #elif FMT_LIBCPP_VERSION && FMT_LIBCPP_VERSION < 10000 @@ -360,6 +364,11 @@ constexpr auto is_constant_evaluated(bool default_value = false) noexcept #elif defined(__cpp_lib_is_constant_evaluated) ignore_unused(default_value); return std::is_constant_evaluated(); + // DIVERGENCE BEGIN - Resolved FMT_USE_CONSTEVAL for MSVC +#elif FMT_MSC_VERSION && FMT_USE_CONSTEVAL + ignore_unused(default_value); + return std::is_constant_evaluated(); +// DIVERGENCE END #else return default_value; #endif