diff --git a/include/fmt/base.h b/include/fmt/base.h index fc9ba1b7..2e82c499 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -1475,9 +1475,8 @@ struct has_format_as #define FMT_MAP_API FMT_CONSTEXPR FMT_ALWAYS_INLINE -// Maps formatting arguments to core types. -// arg_mapper reports errors by returning unformattable instead of using -// static_assert because it's used in the is_formattable trait. +// Maps formatting arguments to reduce the set of types we need to work with. +// Returns unformattable* on errors to be SFINAE-friendly. template struct arg_mapper { using char_type = typename Context::char_type; @@ -2843,19 +2842,14 @@ template FMT_VISIBILITY("hidden") // Suppress an ld warning on macOS (#3769). FMT_CONSTEXPR auto parse_format_specs(parse_context& ctx) -> decltype(ctx.begin()) { - using context = buffered_context; - using mapped_type = - remove_cvref_t().map(std::declval()))>; + using mapper = arg_mapper>; + using mapped = remove_cvref_t()))>; #if defined(__cpp_if_constexpr) - if constexpr (std::is_default_constructible< - formatter>::value) { - return formatter().parse(ctx); - } else { - type_is_unformattable_for _; - return ctx.begin(); - } + if constexpr (std::is_default_constructible>()) + return formatter().parse(ctx); + return ctx.begin(); // Ignore the error - it is reported by make_format_args. #else - return formatter().parse(ctx); + return formatter().parse(ctx); #endif }