From c93208a04d101922f68d1526800b0246336c39d8 Mon Sep 17 00:00:00 2001 From: Nikolay <211292+kolya7k@users.noreply.github.com> Date: Fri, 2 Jul 2021 17:19:35 +0300 Subject: [PATCH] Update core.h Fix compilation when provided user-defined formatter for class instances like template <> struct fmt::formatter { static constexpr auto parse(format_parse_context &ctx) { return ctx.end(); } template auto format(const Player *player, FormatContext &ctx) const { return format_to(ctx.out(), "{}, device {}", player->id, player->device); } }; --- include/fmt/core.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index f0426093..542eb1e1 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1300,7 +1300,9 @@ template struct arg_mapper { // We use SFINAE instead of a const T* parameter to avoid conflicting with // the C array overload. template - FMT_CONSTEXPR auto map(T) -> enable_if_t::value, int> { + FMT_CONSTEXPR auto map(T) -> enable_if_t::value && + !has_formatter::value && + !has_fallback_formatter::value, int> { // Formatting of arbitrary pointers is disallowed. If you want to output // a pointer cast it to "void *" or "const void *". In particular, this // forbids formatting of "[const] volatile char *" which is printed as bool