1 // Copyright (C) 2020-2025 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-do run { target c++11 } }
20 #include <unordered_set>
22 #include <testsuite_allocator.h>
23 #include <testsuite_hooks.h>
30 X(const X
&) = default;
33 // Move constructor might throw
34 X(X
&& x
) noexcept(false)
47 operator()(const X
& x
) const noexcept
54 operator()(const X
& lhs
, const X
& rhs
) const noexcept
55 { return lhs
._i
== rhs
._i
; }
61 using A
= __gnu_test::propagating_allocator
<X
, false>;
63 std::unordered_set
<X
, XHasher
, XEqualTo
, A
> u1(a1
), u2(a2
);
64 u1
= { X(0), X(1), X(2) };
65 u2
= { X(3), X(4), X(5) };
71 VERIFY( u1
.count(X(1)) == 0 );
72 VERIFY( u1
.count(X(3)) == 1 );