From c123096cf14ac87875bba51279e46cceeb18faa1 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 2 Feb 2022 17:04:58 +0000 Subject: [PATCH] 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. --- .../23_containers/multiset/operators/cmp_c++20.cc | 8 ++++++-- .../testsuite/23_containers/set/operators/cmp_c++20.cc | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) 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 -- 2.47.2