From 2b4a858f0da83c5b0c4491d356218e387becf13c Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Sun, 13 Feb 2022 23:19:59 +0500 Subject: [PATCH] Clz builtin may be not constexpr (Issue #2761) --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index afcba52ed043..b97930ffddb7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -991,7 +991,7 @@ FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int { template FMT_CONSTEXPR auto count_digits(UInt n) -> int { #ifdef FMT_BUILTIN_CLZ - if (num_bits() == 32) + if (!is_constant_evaluated() && num_bits() == 32) return (FMT_BUILTIN_CLZ(static_cast(n) | 1) ^ 31) / BITS + 1; #endif // Lambda avoids unreachable code warnings from NVHPC.