libstdc++: Fix invalid instantiations in tests
authorJonathan Wakely <jwakely@redhat.com>
Wed, 2 Feb 2022 17:04:58 +0000 (17:04 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 2 Feb 2022 17:08:54 +0000 (17:08 +0000)
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.

libstdc++-v3/testsuite/23_containers/multiset/operators/cmp_c++20.cc
libstdc++-v3/testsuite/23_containers/set/operators/cmp_c++20.cc

index 3972f75..ad3ab78 100644 (file)
@@ -49,9 +49,13 @@ test01()
   {
     bool operator==(E) { return true; }
   };
-  static_assert( ! std::totally_ordered<std::multiset<E>> );
+  struct Cmp
+  {
+    bool operator()(E, E) const { return false; }
+  };
+  static_assert( ! std::totally_ordered<std::multiset<E, Cmp>> );
   static_assert( ! std::three_way_comparable<E> );
-  static_assert( ! std::three_way_comparable<std::multiset<E>> );
+  static_assert( ! std::three_way_comparable<std::multiset<E, Cmp>> );
 }
 
 void
index fdcb5db..58698bf 100644 (file)
@@ -49,9 +49,13 @@ test01()
   {
     bool operator==(E) { return true; }
   };
-  static_assert( ! std::totally_ordered<std::set<E>> );
+  struct Cmp
+  {
+    bool operator()(E, E) const { return false; }
+  };
+  static_assert( ! std::totally_ordered<std::set<E, Cmp>> );
   static_assert( ! std::three_way_comparable<E> );
-  static_assert( ! std::three_way_comparable<std::set<E>> );
+  static_assert( ! std::three_way_comparable<std::set<E, Cmp>> );
 }
 
 void