diff --git a/include/fmt/core.h b/include/fmt/core.h index 1bcf6442..0d675baf 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -462,6 +462,7 @@ constexpr FMT_ALWAYS_INLINE auto narrow(const char* s) -> const char* { template FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, size_t n) -> int { + if (n == 0) return 0; if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n); for (; n != 0; ++s1, ++s2, --n) { if (*s1 < *s2) return -1;