1 // { dg-do run { target c++17 } }
2 // { dg-require-effective-target std_allocator_new }
3 // { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
5 // Copyright (C) 2021-2025 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
24 #include <string_view>
26 #include <unordered_map>
28 #include <testsuite_hooks.h>
29 #include <replacement_memory_operators.h>
31 static constexpr std::initializer_list
<std::pair
<const char*, const char*>> lst
=
32 { { "long_str_for_dynamic_allocation", "long_str_for_dynamic_allocation" } };
37 __gnu_test::counter::reset();
38 std::unordered_multimap
<std::string
, std::string
,
39 std::hash
<std::string_view
>,
40 std::equal_to
<std::string_view
>> foo
;
41 foo
.insert(lst
.begin(), lst
.end());
42 VERIFY( foo
.size() == 1 );
44 VERIFY( __gnu_test::counter::count() == 4 );
45 VERIFY( __gnu_test::counter::get()._M_increments
== 4 );
51 __gnu_test::counter::reset();
52 std::unordered_multimap
<std::string
, std::string
> foo
;
53 foo
.insert(lst
.begin(), lst
.end());
54 VERIFY( foo
.size() == 1 );
56 VERIFY( __gnu_test::counter::count() == 4 );
57 VERIFY( __gnu_test::counter::get()._M_increments
== 4 );
63 __gnu_test::counter::scope s
;