From 1147782c7950d3725c16ff2a13c5985fb5da5977 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 17 Mar 2021 20:59:36 -0700 Subject: [PATCH] Fix an ambiguous call to check caused by ADL (#2184) --- include/fmt/core.h | 2 +- test/core-test.cc | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index b3f969a9..184d039f 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1460,7 +1460,7 @@ template constexpr const U& check(const U& val) { template constexpr value make_arg(const T& val) { - return check(arg_mapper().map(val)); + return detail::check(arg_mapper().map(val)); } template store; char band[] = "Rolling Stones"; store.push_back(fmt::arg("band", std::cref(band))); - band[9] = 'c'; // Changing band affects the output. + band[9] = 'c'; // Changing band affects the output. EXPECT_EQ(fmt::vformat("{band}", store), "Rolling Scones"); } @@ -690,9 +690,10 @@ TYPED_TEST(IsStringTest, IsString) { EXPECT_FALSE(fmt::detail::is_string::value); } -TEST(CoreTest, Format) { - EXPECT_EQ(fmt::format("{}", 42), "42"); -} +TEST(CoreTest, Format) { EXPECT_EQ(fmt::format("{}", 42), "42"); } + +template void check(T); +TEST(CoreTest, ADL) { EXPECT_EQ(fmt::format("{}", test_struct()), "test"); } TEST(CoreTest, FormatTo) { std::string s;