mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 11:14:41 +00:00
Remove duplicate error in compile-time checks
This commit is contained in:
parent
64a6c84592
commit
4a55b0d5fd
@ -1475,9 +1475,8 @@ struct has_format_as
|
|||||||
|
|
||||||
#define FMT_MAP_API FMT_CONSTEXPR FMT_ALWAYS_INLINE
|
#define FMT_MAP_API FMT_CONSTEXPR FMT_ALWAYS_INLINE
|
||||||
|
|
||||||
// Maps formatting arguments to core types.
|
// Maps formatting arguments to reduce the set of types we need to work with.
|
||||||
// arg_mapper reports errors by returning unformattable instead of using
|
// Returns unformattable* on errors to be SFINAE-friendly.
|
||||||
// static_assert because it's used in the is_formattable trait.
|
|
||||||
template <typename Context> struct arg_mapper {
|
template <typename Context> struct arg_mapper {
|
||||||
using char_type = typename Context::char_type;
|
using char_type = typename Context::char_type;
|
||||||
|
|
||||||
@ -2843,19 +2842,14 @@ 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 parse_format_specs(parse_context<Char>& ctx)
|
FMT_CONSTEXPR auto parse_format_specs(parse_context<Char>& ctx)
|
||||||
-> decltype(ctx.begin()) {
|
-> decltype(ctx.begin()) {
|
||||||
using context = buffered_context<Char>;
|
using mapper = arg_mapper<buffered_context<Char>>;
|
||||||
using mapped_type =
|
using mapped = remove_cvref_t<decltype(mapper().map(std::declval<T&>()))>;
|
||||||
remove_cvref_t<decltype(arg_mapper<context>().map(std::declval<T&>()))>;
|
|
||||||
#if defined(__cpp_if_constexpr)
|
#if defined(__cpp_if_constexpr)
|
||||||
if constexpr (std::is_default_constructible<
|
if constexpr (std::is_default_constructible<formatter<mapped, Char>>())
|
||||||
formatter<mapped_type, Char>>::value) {
|
return formatter<mapped, Char>().parse(ctx);
|
||||||
return formatter<mapped_type, Char>().parse(ctx);
|
return ctx.begin(); // Ignore the error - it is reported by make_format_args.
|
||||||
} else {
|
|
||||||
type_is_unformattable_for<T, Char> _;
|
|
||||||
return ctx.begin();
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
return formatter<mapped_type, Char>().parse(ctx);
|
return formatter<mapped, Char>().parse(ctx);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user