From 78776ee4e228232378a4a27d76fbed1aecd47263 Mon Sep 17 00:00:00 2001 From: Elliot <35050275+Apache-HB@users.noreply.github.com> Date: Wed, 7 Apr 2021 18:42:11 +0100 Subject: [PATCH] Fix a conditional expression is constant warning #2210 (#2211) --- include/fmt/core.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 7d2ba5ac..45bf19bb 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -393,10 +393,13 @@ template class basic_string_view { \endrst */ #if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr. - FMT_CONSTEXPR + constexpr #endif - FMT_INLINE basic_string_view(const Char* s) : data_(s) { - if (std::is_same::value && !detail::is_constant_evaluated()) + FMT_INLINE + basic_string_view(const Char* s) + : data_(s) { + if (detail::const_check(std::is_same::value && + !detail::is_constant_evaluated())) size_ = std::strlen(reinterpret_cast(s)); else size_ = std::char_traits::length(s);