On Mon, 9 Aug 2021 at 11:34, Jonathan Wakely wrote: > > On Mon, 9 Aug 2021 at 11:33, Jonathan Wakely wrote: > > > > On Mon, 9 Aug 2021 at 11:26, François Dumont via Libstdc++ > > <libstd...@gcc.gnu.org> wrote: > > > > > > Some newly introduced tests in > > > 23_containers/unordered_map/cons/default.cc revealed that we are forcing > > > the allocator type to have a operator==. > > > > All allocators are required to have operator== so that should not be a > > problem. What is the error? > > OK, I see it. I just forgot to define operator== and operator!= for > the custom allocator in that new test, and that should be added.
Fixed like this instead. Tested x86_64-linux with -D_GLIBCXX_DEBUG. Pushed to trunk.
commit 2eff2a3cb521c58212885a3dca638764285b5691 Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon Aug 9 11:36:07 2021 libstdc++: Make allocator equality comparable in tests libstdc++-v3/ChangeLog: * testsuite/23_containers/unordered_map/cons/default.cc: Add equality comparison operators to allocator. * testsuite/23_containers/unordered_set/cons/default.cc: Likewise. diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/default.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/default.cc index d64d078a7da..7a785e980b1 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/default.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/default.cc @@ -18,6 +18,9 @@ template<typename T> void deallocate(T *p, std::size_t n) { std::allocator<T>().deallocate(p, n); } + + bool operator==(const NoDefaultConsAlloc&) const { return true; } + bool operator!=(const NoDefaultConsAlloc&) const { return false; } }; using Map = std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/default.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/default.cc index 41281d3d774..fb87c96ce9d 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/default.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/default.cc @@ -18,6 +18,9 @@ template<typename T> void deallocate(T *p, std::size_t n) { std::allocator<T>().deallocate(p, n); } + + bool operator==(const NoDefaultConsAlloc&) const { return true; } + bool operator!=(const NoDefaultConsAlloc&) const { return false; } }; using Set = std::unordered_set<int, std::hash<int>, std::equal_to<int>,