Skip to content

Commit

Permalink
Resolved FMT_USE_CONSTEVAL for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
matt77hias committed Apr 7, 2024
1 parent 3da01e3 commit 96bd924
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 96bd924

Please sign in to comment.