aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-02-02 17:04:58 +0000
committerJonathan Wakely <jwakely@redhat.com>2022-02-02 17:08:54 +0000
commitc123096cf14ac87875bba51279e46cceeb18faa1 (patch)
treecb898bfaa57fb66011f59cc04089a5414a2c349a
parentb229c5186093fa6603030ae83d5fe640ef7051a4 (diff)
downloadgcc-c123096cf14ac87875bba51279e46cceeb18faa1.zip
gcc-c123096cf14ac87875bba51279e46cceeb18faa1.tar.gz
gcc-c123096cf14ac87875bba51279e46cceeb18faa1.tar.bz2
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.
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/operators/cmp_c++20.cc8
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/operators/cmp_c++20.cc8
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 3972f75..ad3ab78 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<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
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 fdcb5db..58698bf 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<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