diff --git a/include/fmt/core.h b/include/fmt/core.h index 9d48fef9..50a6fd8d 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -546,10 +546,10 @@ void to_string_view(...); // Specifies whether S is a string type convertible to fmt::basic_string_view. // It should be a constexpr function but MSVC 2017 fails to compile it in // enable_if and MSVC 2015 fails to compile it as an alias template. -// ADL invocation of to_string_view is DEPRECATED! +// ADL is intentionally disabled as to_string_view is not an extension point. template -struct is_string : std::is_class()))> { -}; +struct is_string + : std::is_class()))> {}; template struct char_t_impl {}; template struct char_t_impl::value>> { diff --git a/test/core-test.cc b/test/core-test.cc index 0994cb8f..71686105 100644 --- a/test/core-test.cc +++ b/test/core-test.cc @@ -88,25 +88,6 @@ TEST(string_view_test, compare) { check_op(); } -namespace test_ns { -template class test_string { - private: - std::basic_string s_; - - public: - test_string(const Char* s) : s_(s) {} - auto data() const -> const Char* { return s_.data(); } - auto length() const -> size_t { return s_.size(); } - operator const Char*() const { return s_.c_str(); } -}; - -template -auto to_string_view(const test_string& s) - -> fmt::basic_string_view { - return {s.data(), s.length()}; -} -} // namespace test_ns - TEST(core_test, is_output_iterator) { EXPECT_TRUE((fmt::detail::is_output_iterator::value)); EXPECT_FALSE((fmt::detail::is_output_iterator::value)); @@ -769,15 +750,6 @@ TEST(core_test, adl_check) { EXPECT_EQ(fmt::format("{}", test_struct()), "test"); } -TEST(core_test, to_string_view_foreign_strings) { - using namespace test_ns; - EXPECT_EQ(to_string_view(test_string("42")), "42"); - fmt::detail::type type = - fmt::detail::mapped_type_constant, - fmt::format_context>::value; - EXPECT_EQ(type, fmt::detail::type::string_type); -} - struct implicitly_convertible_to_string_view { operator fmt::string_view() const { return "foo"; } }; diff --git a/test/format-test.cc b/test/format-test.cc index b528986b..98395353 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1866,9 +1866,6 @@ TEST(format_test, unpacked_args) { 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g')); } -struct string_like {}; -fmt::string_view to_string_view(string_like) { return "foo"; } - constexpr char with_null[3] = {'{', '}', '\0'}; constexpr char no_null[2] = {'{', '}'}; static constexpr const char static_with_null[3] = {'{', '}', '\0'}; @@ -1877,7 +1874,6 @@ static constexpr const char static_no_null[2] = {'{', '}'}; TEST(format_test, compile_time_string) { EXPECT_EQ("foo", fmt::format(FMT_STRING("foo"))); EXPECT_EQ("42", fmt::format(FMT_STRING("{}"), 42)); - EXPECT_EQ("foo", fmt::format(FMT_STRING("{}"), string_like())); #if FMT_USE_NONTYPE_TEMPLATE_ARGS using namespace fmt::literals; diff --git a/test/xchar-test.cc b/test/xchar-test.cc index 022646da..cfdaf76f 100644 --- a/test/xchar-test.cc +++ b/test/xchar-test.cc @@ -30,25 +30,7 @@ using testing::Contains; # define FMT_HAS_C99_STRFTIME 1 #endif -namespace test_ns { -template class test_string { - private: - std::basic_string s_; - - public: - test_string(const Char* s) : s_(s) {} - const Char* data() const { return s_.data(); } - size_t length() const { return s_.size(); } - operator const Char*() const { return s_.c_str(); } -}; - -template -fmt::basic_string_view to_string_view(const test_string& s) { - return {s.data(), s.length()}; -} - struct non_string {}; -} // namespace test_ns template class is_string_test : public testing::Test {}; @@ -70,8 +52,7 @@ TYPED_TEST(is_string_test, is_string) { using fmt_string_view = fmt::detail::std_string_view; EXPECT_TRUE(std::is_empty::value != fmt::detail::is_string::value); - EXPECT_TRUE(fmt::detail::is_string>::value); - EXPECT_FALSE(fmt::detail::is_string::value); + EXPECT_FALSE(fmt::detail::is_string::value); } // std::is_constructible is broken in MSVC until version 2015.