diff --git a/libcxx/docs/Status/Cxx2bIssues.csv b/libcxx/docs/Status/Cxx2bIssues.csv --- a/libcxx/docs/Status/Cxx2bIssues.csv +++ b/libcxx/docs/Status/Cxx2bIssues.csv @@ -173,7 +173,7 @@ "`3702 `__","Should ``zip_transform_view::iterator`` remove ``operator<``","July 2022","","" "`3703 `__","Missing requirements for ``expected`` requires ``is_void``","July 2022","","" "`3704 `__","LWG 2059 added overloads that might be ill-formed for sets","July 2022","","" -"`3705 `__","Hashability shouldn't depend on basic_string's allocator","July 2022","","" +"`3705 `__","Hashability shouldn't depend on basic_string's allocator","July 2022","|Complete|","16.0" "`3707 `__","chunk_view::outer-iterator::value_type::size should return unsigned type","July 2022","","","|ranges|" "`3708 `__","``take_while_view::sentinel``'s conversion constructor should move","July 2022","","","|ranges|" "`3709 `__","LWG-3703 was underly ambitious","July 2022","","" diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -4597,15 +4597,32 @@ basic_string<_CharT, _Traits, _Allocator>::npos; template -struct _LIBCPP_TEMPLATE_VIS - hash, _Allocator> > - : public __unary_function, _Allocator>, size_t> +struct __string_hash : public __unary_function, _Allocator>, size_t> { size_t operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT { return __do_string_hash(__val.data(), __val.data() + __val.size()); } }; +template +struct hash, _Allocator> > : __string_hash {}; + +#ifndef _LIBCPP_HAS_NO_CHAR8_T +template +struct hash, _Allocator> > : __string_hash {}; +#endif + +template +struct hash, _Allocator> > : __string_hash {}; + +template +struct hash, _Allocator> > : __string_hash {}; + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template +struct hash, _Allocator> > : __string_hash {}; +#endif + template _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, @@ -4719,7 +4736,7 @@ #ifndef _LIBCPP_HAS_NO_CHAR8_T inline _LIBCPP_HIDE_FROM_ABI constexpr - basic_string operator "" s(const char8_t *__str, size_t __len) _NOEXCEPT + basic_string operator "" s(const char8_t *__str, size_t __len) { return basic_string (__str, __len); } diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -962,8 +962,7 @@ // [string.view.hash] template -struct _LIBCPP_TEMPLATE_VIS hash > > - : public __unary_function >, size_t> +struct __string_view_hash : public __unary_function >, size_t> { _LIBCPP_INLINE_VISIBILITY size_t operator()(const basic_string_view<_CharT, char_traits<_CharT> > __val) const _NOEXCEPT { @@ -971,6 +970,25 @@ } }; +template <> +struct hash > > : __string_view_hash {}; + +#ifndef _LIBCPP_HAS_NO_CHAR8_T +template <> +struct hash > > : __string_view_hash {}; +#endif + +template <> +struct hash > > : __string_view_hash {}; + +template <> +struct hash > > : __string_view_hash {}; + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template <> +struct hash > > : __string_view_hash {}; +#endif + #if _LIBCPP_STD_VER > 11 inline namespace literals { diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp --- a/libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp +++ b/libcxx/test/libcxx/diagnostics/enable_nodiscard.verify.cpp @@ -20,8 +20,8 @@ _LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; } int main(int, char**) { - foo(); // expected-warning-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} - bar(); // expected-warning-re {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + foo(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} + bar(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}} (void)foo(); // OK. void casts disable the diagnostic. (void)bar(); diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp --- a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp +++ b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_after_cxx17.verify.cpp @@ -20,7 +20,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; } int main(int, char**) { - foo(); // expected-warning-re{{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + foo(); // expected-warning{{ignoring return value of function declared with 'nodiscard' attribute}} bar(); // OK. (void)foo(); // OK. diff --git a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp --- a/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp +++ b/libcxx/test/libcxx/diagnostics/enable_nodiscard_disable_nodiscard_ext.verify.cpp @@ -17,7 +17,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 int bar() { return 42; } int main(int, char**) { - bar(); // expected-warning-re{{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + bar(); // expected-warning{{ignoring return value of function declared with 'nodiscard' attribute}} foo(); // OK. (void)bar(); // OK. diff --git a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp --- a/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp +++ b/libcxx/test/libcxx/diagnostics/nodiscard_extensions.verify.cpp @@ -35,289 +35,289 @@ void test_algorithms() { int arr[1] = { 1 }; - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::adjacent_find(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::adjacent_find(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::all_of(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::any_of(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::binary_search(std::begin(arr), std::end(arr), 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::binary_search(std::begin(arr), std::end(arr), 1, std::greater()); #if TEST_STD_VER >= 17 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::clamp(2, 1, 3); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::clamp(2, 1, 3, std::greater()); #endif - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::count_if(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::count(std::begin(arr), std::end(arr), 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::equal_range(std::begin(arr), std::end(arr), 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::equal_range(std::begin(arr), std::end(arr), 1, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::equal(std::begin(arr), std::end(arr), std::begin(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::greater()); #if TEST_STD_VER >= 14 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::equal(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); #endif - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::find_end(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::find_first_of(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::find_if_not(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::find_if(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::find(std::begin(arr), std::end(arr), 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::get_temporary_buffer(1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::includes(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_heap_until(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_heap_until(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_heap(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_heap(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_partitioned(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::greater()); #if TEST_STD_VER >= 14 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_permutation(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); #endif - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_sorted_until(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_sorted_until(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_sorted(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::is_sorted(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::lexicographical_compare(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::lower_bound(std::begin(arr), std::end(arr), 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::lower_bound(std::begin(arr), std::end(arr), 1, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::max_element(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::max_element(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::max(1, 2); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::max(1, 2, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::max({1, 2, 3}); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::max({1, 2, 3}, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::min_element(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::min_element(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::min(1, 2); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::min(1, 2, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::min({1, 2, 3}); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::min({1, 2, 3}, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::minmax_element(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::minmax_element(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::minmax(1, 2); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::minmax(1, 2, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::minmax({1, 2, 3}); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::minmax({1, 2, 3}, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::mismatch(std::begin(arr), std::end(arr), std::begin(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::greater()); #if TEST_STD_VER >= 14 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::mismatch(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); #endif - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::none_of(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::remove_if(std::begin(arr), std::end(arr), P()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::remove(std::begin(arr), std::end(arr), 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::search_n(std::begin(arr), std::end(arr), 1, 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::search_n(std::begin(arr), std::end(arr), 1, 1, std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::search(std::begin(arr), std::end(arr), std::begin(arr), std::end(arr), std::greater()); #if TEST_STD_VER >= 17 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::search(std::begin(arr), std::end(arr), std::default_searcher(std::begin(arr), std::end(arr))); #endif - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::unique(std::begin(arr), std::end(arr)); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::unique(std::begin(arr), std::end(arr), std::greater()); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::upper_bound(std::begin(arr), std::end(arr), 1); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::upper_bound(std::begin(arr), std::end(arr), 1, std::greater()); } template void test_template_cast_wrappers(LV&& lv, RV&& rv) { - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::forward(lv); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::forward(rv); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::move(lv); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::move(rv); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::move_if_noexcept(lv); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::move_if_noexcept(rv); #if TEST_STD_VER >= 17 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::as_const(lv); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::as_const(rv); #endif #if TEST_STD_VER >= 20 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::identity()(lv); - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::identity()(rv); #endif } @@ -326,18 +326,18 @@ { #if TEST_STD_VER > 14 std::byte b{42}; - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::to_integer(b); #endif #if TEST_STD_VER > 17 - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::bit_cast(42); #endif #if TEST_STD_VER > 20 enum E { Apple, Orange } e = Apple; - // expected-warning-re@+1 {{ignoring return value of function declared with {{'nodiscard'|warn_unused_result}} attribute}} + // expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}} std::to_underlying(e); #endif } diff --git a/libcxx/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp b/libcxx/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp --- a/libcxx/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp +++ b/libcxx/test/std/strings/basic.string.hash/enabled_hashes.pass.cpp @@ -15,10 +15,15 @@ #include +#include "constexpr_char_traits.h" #include "poisoned_hash_helper.h" - +#include "test_allocator.h" #include "test_macros.h" +struct MyChar { + char c; +}; + int main(int, char**) { test_library_hash_specializations_available(); { @@ -26,11 +31,14 @@ #ifndef TEST_HAS_NO_WIDE_CHARACTERS test_hash_enabled_for_type(); #endif -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +#ifndef TEST_HAS_NO_CHAR8_T test_hash_enabled_for_type(); #endif test_hash_enabled_for_type(); test_hash_enabled_for_type(); + test_hash_enabled_for_type, test_allocator>>(); + test_hash_disabled_for_type, std::allocator>>(); + test_hash_disabled_for_type, std::allocator>>(); } return 0; diff --git a/libcxx/test/std/strings/basic.string.literals/noexcept.compile.pass.cpp b/libcxx/test/std/strings/basic.string.literals/noexcept.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/strings/basic.string.literals/noexcept.compile.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11 + +#include + +#include "test_macros.h" + +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#ifndef TEST_HAS_NO_CHAR8_T +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#endif +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#endif diff --git a/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp b/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp --- a/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp +++ b/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp @@ -26,7 +26,7 @@ #ifndef TEST_HAS_NO_WIDE_CHARACTERS static_assert((std::is_same >::value), ""); #endif -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +#ifndef TEST_HAS_NO_CHAR8_T static_assert((std::is_same >::value), ""); #endif static_assert((std::is_same >::value), ""); diff --git a/libcxx/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp b/libcxx/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp --- a/libcxx/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp +++ b/libcxx/test/std/strings/string.view/string.view.hash/enabled_hashes.pass.cpp @@ -16,10 +16,14 @@ #include +#include "constexpr_char_traits.h" #include "poisoned_hash_helper.h" - #include "test_macros.h" +struct MyChar { + char c; +}; + int main(int, char**) { test_library_hash_specializations_available(); { @@ -27,11 +31,13 @@ #ifndef TEST_HAS_NO_WIDE_CHARACTERS test_hash_enabled_for_type(); #endif -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +#ifndef TEST_HAS_NO_CHAR8_T test_hash_enabled_for_type(); #endif test_hash_enabled_for_type(); test_hash_enabled_for_type(); + test_hash_disabled_for_type>>(); + test_hash_disabled_for_type>>(); } return 0;