diff --git a/include/fmt/base.h b/include/fmt/base.h index 18fe1003..4d6a33bc 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 baa932bc..1bcdc548 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) {