Improve error reporting

This commit is contained in:
Victor Zverovich
2024-09-14 09:37:04 -07:00
parent de28ef5f86
commit a0328e1f9f

View File

@ -1710,13 +1710,11 @@ template <typename T, typename Char>
FMT_VISIBILITY("hidden") // Suppress an ld warning on macOS (#3769). FMT_VISIBILITY("hidden") // Suppress an ld warning on macOS (#3769).
FMT_CONSTEXPR auto invoke_parse(parse_context<Char>& ctx) -> const Char* { FMT_CONSTEXPR auto invoke_parse(parse_context<Char>& ctx) -> const Char* {
using mapped_type = remove_cvref_t<mapped_t<T, Char>>; using mapped_type = remove_cvref_t<mapped_t<T, Char>>;
#if defined(__cpp_if_constexpr) constexpr bool formattable =
if constexpr (std::is_default_constructible<formatter<mapped_type, Char>>()) std::is_constructible<formatter<mapped_type, Char>>::value;
return formatter<mapped_type, Char>().parse(ctx); if (!formattable) return ctx.begin(); // Error is reported in the value ctor.
return ctx.begin(); // Ignore the error - it is reported in the value ctor. using formatted_type = conditional_t<formattable, mapped_type, int>;
#else return formatter<formatted_type, Char>().parse(ctx);
return formatter<mapped_type, Char>().parse(ctx);
#endif
} }
template <typename... T> struct arg_pack {}; template <typename... T> struct arg_pack {};