mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Fix an ambiguous call to check caused by ADL (#2184)
This commit is contained in:
@ -1460,7 +1460,7 @@ template <typename T, typename U> constexpr const U& check(const U& val) {
|
|||||||
template <bool IS_PACKED, typename Context, type, typename T,
|
template <bool IS_PACKED, typename Context, type, typename T,
|
||||||
FMT_ENABLE_IF(IS_PACKED)>
|
FMT_ENABLE_IF(IS_PACKED)>
|
||||||
constexpr value<Context> make_arg(const T& val) {
|
constexpr value<Context> make_arg(const T& val) {
|
||||||
return check<T>(arg_mapper<Context>().map(val));
|
return detail::check<T>(arg_mapper<Context>().map(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool IS_PACKED, typename Context, type, typename T,
|
template <bool IS_PACKED, typename Context, type, typename T,
|
||||||
|
@ -471,7 +471,7 @@ TEST(FormatDynArgsTest, NamedArgByRef) {
|
|||||||
fmt::dynamic_format_arg_store<fmt::format_context> store;
|
fmt::dynamic_format_arg_store<fmt::format_context> store;
|
||||||
char band[] = "Rolling Stones";
|
char band[] = "Rolling Stones";
|
||||||
store.push_back(fmt::arg("band", std::cref(band)));
|
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");
|
EXPECT_EQ(fmt::vformat("{band}", store), "Rolling Scones");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,9 +690,10 @@ TYPED_TEST(IsStringTest, IsString) {
|
|||||||
EXPECT_FALSE(fmt::detail::is_string<my_ns::non_string>::value);
|
EXPECT_FALSE(fmt::detail::is_string<my_ns::non_string>::value);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CoreTest, Format) {
|
TEST(CoreTest, Format) { EXPECT_EQ(fmt::format("{}", 42), "42"); }
|
||||||
EXPECT_EQ(fmt::format("{}", 42), "42");
|
|
||||||
}
|
template <typename T> void check(T);
|
||||||
|
TEST(CoreTest, ADL) { EXPECT_EQ(fmt::format("{}", test_struct()), "test"); }
|
||||||
|
|
||||||
TEST(CoreTest, FormatTo) {
|
TEST(CoreTest, FormatTo) {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
Reference in New Issue
Block a user