Skip to content

Commit

Permalink
Workaround for incompatible between libstdc++ consteval based std::is…
Browse files Browse the repository at this point in the history
…_constant_evaluated implementation and clang-14+

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
  • Loading branch information
phprus committed Jan 21, 2023
1 parent f89cd27 commit 3892463
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,14 @@ template <typename... T> FMT_CONSTEXPR void ignore_unused(const T&...) {}

constexpr FMT_INLINE auto is_constant_evaluated(
bool default_value = false) noexcept -> bool {
#ifdef __cpp_lib_is_constant_evaluated
// Workaround for incompatible between libstdc++ consteval based
// std::is_constant_evaluated implementation and clang-14+.
// https://github.com/fmtlib/fmt/issues/3247
#if FMT_CPLUSPLUS >= 202002L && defined(_GLIBCXX_RELEASE) && \
_GLIBCXX_RELEASE >= 12 && FMT_CLANG_VERSION >= 14
ignore_unused(default_value);
return __builtin_is_constant_evaluated();
#elif defined(__cpp_lib_is_constant_evaluated)
ignore_unused(default_value);
return std::is_constant_evaluated();
#else
Expand Down

0 comments on commit 3892463

Please sign in to comment.