From 0a24a0714ef5f6ff4bbd17a43a17289133414338 Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Tue, 15 Feb 2022 07:19:06 +0500 Subject: [PATCH] Clz builtin may be not constexpr (Issue #2761) (#2762) --- 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 99d1af6d..989b05b8 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.