diff --git a/include/fmt/base.h b/include/fmt/base.h index bc9cfb2f7056b..ec78ae28da53c 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -175,8 +175,7 @@ #endif // Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings. -#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && FMT_EXCEPTIONS && !FMT_MSC_VERSION && \ - !defined(__NVCC__) +#if FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && !defined(__NVCC__) # define FMT_NORETURN [[noreturn]] #else # define FMT_NORETURN @@ -2754,7 +2753,7 @@ template class format_string_checker { return id >= 0 && id < num_args ? parse_funcs_[id](context_) : begin; } - FMT_CONSTEXPR void on_error(const char* message) { report_error(message); } + FMT_NORETURN FMT_CONSTEXPR void on_error(const char* message) { report_error(message); } }; // A base class for compile-time strings. diff --git a/include/fmt/format.h b/include/fmt/format.h index 3aaee42f67080..541bf11d51272 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4302,7 +4302,7 @@ void vformat_to(buffer& buf, basic_string_view fmt, return begin; } - void on_error(const char* message) { report_error(message); } + FMT_NORETURN void on_error(const char* message) { report_error(message); } }; detail::parse_format_string(fmt, format_handler(out, fmt, args, loc)); }