1 // Copyright (C) 2017-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_map>
21 #include <testsuite_hooks.h>
22 #include <testsuite_allocator.h>
24 struct fails_on_copy
{
25 fails_on_copy() = default;
26 fails_on_copy(const fails_on_copy
&) { throw 0; };
29 using value_type
= std::pair
<const int, fails_on_copy
>;
37 std::unordered_map
<int, fails_on_copy
> umap(&p
, &p
+ 1);
46 using Alloc
= __gnu_test::tracker_allocator
<value_type
>;
53 std::unordered_map
<int, fails_on_copy
, hash
<int>, equal_to
<int>, Alloc
>
59 using counter
= __gnu_test::tracker_allocator_counter
;
60 VERIFY(counter::get_allocation_count() == counter::get_deallocation_count());