diff --git a/include/fmt/core.h b/include/fmt/core.h index d54a0784..42e930a9 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -395,8 +395,12 @@ template class basic_string_view { #if __cplusplus >= 201703L // C++17's char_traits::length() is constexpr. FMT_CONSTEXPR #endif - FMT_INLINE basic_string_view(const Char* s) - : data_(s), size_(std::char_traits::length(s)) {} + FMT_INLINE basic_string_view(const Char* s) : data_(s) { + if (std::is_same::value) + size_ = std::strlen(reinterpret_cast(s)); + else + size_ = std::char_traits::length(s); + } /** Constructs a string reference from a ``std::basic_string`` object. */ template