From: Jonathan Wakely Date: Wed, 2 Feb 2022 17:04:58 +0000 (+0000) Subject: libstdc++: Fix invalid instantiations in tests X-Git-Tag: basepoints/gcc-13~1309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c123096cf14ac87875bba51279e46cceeb18faa1;p=thirdparty%2Fgcc.git libstdc++: Fix invalid instantiations in tests These tests instantiate std::multiset and std::set with a type that has no operator< so they should use a custom comparison function. libstdc++-v3/ChangeLog: * testsuite/23_containers/multiset/operators/cmp_c++20.cc: Use custom comparison function for multiset. * testsuite/23_containers/set/operators/cmp_c++20.cc: Use custom comparison function for set. --- diff --git a/libstdc++-v3/testsuite/23_containers/multiset/operators/cmp_c++20.cc b/libstdc++-v3/testsuite/23_containers/multiset/operators/cmp_c++20.cc index 3972f756af96..ad3ab7879466 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/operators/cmp_c++20.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/operators/cmp_c++20.cc @@ -49,9 +49,13 @@ test01() { bool operator==(E) { return true; } }; - static_assert( ! std::totally_ordered> ); + struct Cmp + { + bool operator()(E, E) const { return false; } + }; + static_assert( ! std::totally_ordered> ); static_assert( ! std::three_way_comparable ); - static_assert( ! std::three_way_comparable> ); + static_assert( ! std::three_way_comparable> ); } void diff --git a/libstdc++-v3/testsuite/23_containers/set/operators/cmp_c++20.cc b/libstdc++-v3/testsuite/23_containers/set/operators/cmp_c++20.cc index fdcb5db699d6..58698bf426ff 100644 --- a/libstdc++-v3/testsuite/23_containers/set/operators/cmp_c++20.cc +++ b/libstdc++-v3/testsuite/23_containers/set/operators/cmp_c++20.cc @@ -49,9 +49,13 @@ test01() { bool operator==(E) { return true; } }; - static_assert( ! std::totally_ordered> ); + struct Cmp + { + bool operator()(E, E) const { return false; } + }; + static_assert( ! std::totally_ordered> ); static_assert( ! std::three_way_comparable ); - static_assert( ! std::three_way_comparable> ); + static_assert( ! std::three_way_comparable> ); } void