Don't use strlen at compile time (#2205)

This commit is contained in:
Victor Zverovich 2021-04-01 10:04:21 -07:00
parent c62e4c30f4
commit 7c43f8b896

View File

@ -396,7 +396,7 @@ template <typename Char> class basic_string_view {
FMT_CONSTEXPR
#endif
FMT_INLINE basic_string_view(const Char* s) : data_(s) {
if (std::is_same<Char, char>::value)
if (std::is_same<Char, char>::value && !detail::is_constant_evaluated())
size_ = std::strlen(reinterpret_cast<const char*>(s));
else
size_ = std::char_traits<Char>::length(s);