From 33f715077832d4f54bb51aa5aaf5b769fec97b67 Mon Sep 17 00:00:00 2001 From: June Liu <103498042+Zhaojun-Liu@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:27:28 +0800 Subject: [PATCH] Fix error C2668 on msvc (#3378) --- include/fmt/ostream.h | 2 +- test/args-test.cc | 2 +- test/format-impl-test.cc | 2 +- test/format-test.cc | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index ab9a7d55..3238389d 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -193,7 +193,7 @@ void print(std::wostream& os, FMT_MODULE_EXPORT template void println(std::ostream& os, format_string fmt, T&&... args) { - print(os, "{}\n", fmt::format(fmt, std::forward(args)...)); + fmt::print(os, "{}\n", fmt::format(fmt, std::forward(args)...)); } FMT_MODULE_EXPORT diff --git a/test/args-test.cc b/test/args-test.cc index aa01fa4e..3ab31335 100644 --- a/test/args-test.cc +++ b/test/args-test.cc @@ -44,7 +44,7 @@ template <> struct formatter { template auto format(const custom_type& p, FormatContext& ctx) -> decltype(ctx.out()) { - return format_to(ctx.out(), "cust={}", p.i); + return fmt::format_to(ctx.out(), "cust={}", p.i); } }; FMT_END_NAMESPACE diff --git a/test/format-impl-test.cc b/test/format-impl-test.cc index 02101a21..95f897db 100644 --- a/test/format-impl-test.cc +++ b/test/format-impl-test.cc @@ -301,7 +301,7 @@ TEST(format_impl_test, format_error_code) { std::string msg = "error 42", sep = ": "; { auto buffer = fmt::memory_buffer(); - format_to(fmt::appender(buffer), "garbage"); + fmt::format_to(fmt::appender(buffer), "garbage"); fmt::detail::format_error_code(buffer, 42, "test"); EXPECT_EQ(to_string(buffer), "test: " + msg); } diff --git a/test/format-test.cc b/test/format-test.cc index e798da1d..6e8578a0 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1638,7 +1638,7 @@ struct fmt::formatter : formatter { auto format(explicitly_convertible_to_std_string_view v, format_context& ctx) -> decltype(ctx.out()) { - return format_to(ctx.out(), "'{}'", std::string_view(v)); + return fmt::format_to(ctx.out(), "'{}'", std::string_view(v)); } }; @@ -1702,7 +1702,7 @@ TEST(format_test, format_examples) { EXPECT_EQ("42", fmt::format("{}", 42)); memory_buffer out; - format_to(std::back_inserter(out), "The answer is {}.", 42); + fmt::format_to(std::back_inserter(out), "The answer is {}.", 42); EXPECT_EQ("The answer is 42.", to_string(out)); const char* filename = "nonexistent"; @@ -1837,7 +1837,7 @@ TEST(format_test, join_bytes) { std::string vformat_message(int id, const char* format, fmt::format_args args) { auto buffer = fmt::memory_buffer(); - format_to(fmt::appender(buffer), "[{}] ", id); + fmt::format_to(fmt::appender(buffer), "[{}] ", id); vformat_to(fmt::appender(buffer), format, args); return to_string(buffer); }