Fix a conditional expression is constant warning #2210 (#2211)

This commit is contained in:
Elliot 2021-04-07 18:42:11 +01:00 committed by GitHub
parent 266107f57c
commit 78776ee4e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -393,10 +393,13 @@ template <typename Char> class basic_string_view {
\endrst \endrst
*/ */
#if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr. #if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr.
FMT_CONSTEXPR constexpr
#endif #endif
FMT_INLINE basic_string_view(const Char* s) : data_(s) { FMT_INLINE
if (std::is_same<Char, char>::value && !detail::is_constant_evaluated()) basic_string_view(const Char* s)
: data_(s) {
if (detail::const_check(std::is_same<Char, char>::value &&
!detail::is_constant_evaluated()))
size_ = std::strlen(reinterpret_cast<const char*>(s)); size_ = std::strlen(reinterpret_cast<const char*>(s));
else else
size_ = std::char_traits<Char>::length(s); size_ = std::char_traits<Char>::length(s);