diff --git a/include/fmt/base.h b/include/fmt/base.h index 18fe100384ae..4d6a33bc51db 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -467,6 +467,7 @@ template FMT_CONSTEXPR auto length(const Char* s) -> size_t { template FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n) -> int { + if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n); for (; n != 0; ++s1, ++s2, --n) { if (*s1 < *s2) return -1; if (*s1 > *s2) return 1; diff --git a/test/scan.h b/test/scan.h index baa932bcf313..1bcdc5489cec 100644 --- a/test/scan.h +++ b/test/scan.h @@ -553,7 +553,7 @@ struct scan_handler { return begin; } - void on_error(const char* message) { report_error(message); } + FMT_NORETURN void on_error(const char* message) { report_error(message); } }; void vscan(detail::scan_buffer& buf, string_view fmt, scan_args args) {