Fixed format.h(2351,1): warning C4127: conditional expression is constant

This commit is contained in:
Ivan Shynkarenka 2020-01-20 12:35:26 +03:00
parent 9e2e299c5a
commit c9cb487614

View File

@ -2348,17 +2348,21 @@ template <typename SpecHandler, typename Char> struct precision_adapter {
template <typename Char> template <typename Char>
FMT_CONSTEXPR const Char* next_code_point(const Char* begin, const Char* end) { FMT_CONSTEXPR const Char* next_code_point(const Char* begin, const Char* end) {
#ifdef __cpp_if_constexpr #ifdef __cpp_if_constexpr
if (constexpr (sizeof(Char) != 1) || (*begin & 0x80) == 0) return begin + 1; if constexpr (sizeof(Char) == 1) {
#else #else
if (sizeof(Char) != 1 || (*begin & 0x80) == 0) return begin + 1; if (sizeof(Char) == 1) {
#endif #endif
if ((*begin & 0x80) != 0) {
do { do {
++begin; ++begin;
} while (begin != end && (*begin & 0xc0) == 0x80); } while (begin != end && (*begin & 0xc0) == 0x80);
return begin; return begin;
} }
}
(void)end; // 'end': unreferenced formal parameter
return begin + 1;
}
// Parses fill and alignment. // Parses fill and alignment.
template <typename Char, typename Handler> template <typename Char, typename Handler>