diff --git a/deps/fmt/include/fmt/format.h b/deps/fmt/include/fmt/format.h index 29221289..20ec7ee1 100644 --- a/deps/fmt/include/fmt/format.h +++ b/deps/fmt/include/fmt/format.h @@ -1810,8 +1810,13 @@ auto write(OutputIt out, const T& value) -> typename std::enable_if< mapped_type_constant>::value == type::custom_type, OutputIt>::type { - basic_format_context ctx(out, {}, {}); - return formatter().format(value, ctx); + using context_type = basic_format_context; + using formatter_type = + conditional_t::value, + typename context_type::template formatter_type, + fallback_formatter>; + context_type ctx(out, {}, {}); + return formatter_type().format(value, ctx); } // An argument visitor that formats the argument and writes it via the output diff --git a/deps/fmt/test/ostream-test.cc b/deps/fmt/test/ostream-test.cc index 1c87d46d..336c1ea5 100644 --- a/deps/fmt/test/ostream-test.cc +++ b/deps/fmt/test/ostream-test.cc @@ -307,3 +307,7 @@ TEST(OStreamTest, CopyFmt) { TEST(OStreamTest, CompileTimeString) { EXPECT_EQ("42", fmt::format(FMT_STRING("{}"), 42)); } + +TEST(OStreamTest, ToString) { + EXPECT_EQ("ABC", fmt::to_string(fmt_test::ABC())); +}