1 // { dg-do compile { target c++11 } }
3 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 #include <unordered_map>
22 using type1
= std::unordered_map
<int, int>;
24 static_assert( std::is_nothrow_move_constructible
<type1
>::value
,
25 "noexcept move constructor" );
26 static_assert( std::is_nothrow_constructible
<type1
,
27 type1
&&, const typename
type1::allocator_type
&>::value
,
28 "noexcept move constructor with allocator" );
30 struct not_noexcept_copy_cons_hash
32 not_noexcept_copy_cons_hash() noexcept
;
33 not_noexcept_copy_cons_hash(const not_noexcept_copy_cons_hash
&) /* noexcept */;
34 not_noexcept_copy_cons_hash(not_noexcept_copy_cons_hash
&&) noexcept
;
37 operator()(int) const noexcept
;
40 using type2
= std::unordered_map
<int, int, not_noexcept_copy_cons_hash
>;
42 static_assert( !std::is_nothrow_move_constructible
<type2
>::value
,
43 "not noexcept move constructor" );
44 static_assert( !std::is_nothrow_constructible
<type2
, type2
&&,
45 const typename
type2::allocator_type
&>::value
,
46 "not noexcept move constructor with allocator" );
48 struct not_noexcept_copy_cons_equal_to
50 not_noexcept_copy_cons_equal_to() noexcept
;
51 not_noexcept_copy_cons_equal_to(const not_noexcept_copy_cons_equal_to
&) /* noexcept */;
52 not_noexcept_copy_cons_equal_to(not_noexcept_copy_cons_equal_to
&&) noexcept
;
55 operator()(int, int) const noexcept
;
58 using type3
= std::unordered_map
<int, int, std::hash
<int>,
59 not_noexcept_copy_cons_equal_to
>;
61 static_assert( !std::is_nothrow_move_constructible
<type3
>::value
,
62 "not noexcept move constructor" );
63 static_assert( !std::is_nothrow_constructible
<type3
, type3
&&,
64 const typename
type3::allocator_type
&>::value
,
65 "not noexcept move constructor with allocator" );