From a0328e1f9fd841e950719cab8fbaeacdb7964e02 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 14 Sep 2024 09:37:04 -0700 Subject: [PATCH] Improve error reporting --- include/fmt/base.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index fa41e6f28185..856ca42603de 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -1710,13 +1710,11 @@ template FMT_VISIBILITY("hidden") // Suppress an ld warning on macOS (#3769). FMT_CONSTEXPR auto invoke_parse(parse_context& ctx) -> const Char* { using mapped_type = remove_cvref_t>; -#if defined(__cpp_if_constexpr) - if constexpr (std::is_default_constructible>()) - return formatter().parse(ctx); - return ctx.begin(); // Ignore the error - it is reported in the value ctor. -#else - return formatter().parse(ctx); -#endif + constexpr bool formattable = + std::is_constructible>::value; + if (!formattable) return ctx.begin(); // Error is reported in the value ctor. + using formatted_type = conditional_t; + return formatter().parse(ctx); } template struct arg_pack {};