diff --git a/include/fmt/base.h b/include/fmt/base.h index fa41e6f2..856ca426 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 {};