diff --git a/format.cc b/format.cc index 6f02a81d..fe4f1b18 100644 --- a/format.cc +++ b/format.cc @@ -66,10 +66,8 @@ using fmt::internal::Arg; #ifndef FMT_THROW # if FMT_EXCEPTIONS # define FMT_THROW(x) throw x -# define FMT_RETURN_AFTER_THROW(x) # else # define FMT_THROW(x) assert(false) -# define FMT_RETURN_AFTER_THROW(x) return x # endif #endif @@ -291,9 +289,8 @@ class WidthHandler : public fmt::internal::ArgVisitor { public: explicit WidthHandler(fmt::FormatSpec &spec) : spec_(spec) {} - unsigned visit_unhandled_arg() { + void report_unhandled_arg() { FMT_THROW(fmt::FormatError("width is not integer")); - FMT_RETURN_AFTER_THROW(0); } template @@ -313,9 +310,8 @@ class WidthHandler : public fmt::internal::ArgVisitor { class PrecisionHandler : public fmt::internal::ArgVisitor { public: - unsigned visit_unhandled_arg() { + void report_unhandled_arg() { FMT_THROW(fmt::FormatError("precision is not integer")); - FMT_RETURN_AFTER_THROW(0); } template diff --git a/format.h b/format.h index ca3e5e96..a9ee73d5 100644 --- a/format.h +++ b/format.h @@ -962,7 +962,12 @@ class MakeArg : public Arg { template class ArgVisitor { public: - Result visit_unhandled_arg() { return Result(); } + void report_unhandled_arg() {} + + Result visit_unhandled_arg() { + FMT_DISPATCH(report_unhandled_arg()); + return Result(); + } Result visit_int(int value) { return FMT_DISPATCH(visit_any_int(value));