Skip to content

Commit

Permalink
Fix a conditional expression is constant warning #2210 (#2211)
Browse files Browse the repository at this point in the history
  • Loading branch information
apache-hb authored Apr 7, 2021
1 parent 266107f commit 78776ee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,13 @@ template <typename Char> 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<Char, char>::value && !detail::is_constant_evaluated())
FMT_INLINE
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));
else
size_ = std::char_traits<Char>::length(s);
Expand Down

0 comments on commit 78776ee

Please sign in to comment.