]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 23_containers / unordered_multiset / cons / noexcept_default_construct.cc
CommitLineData
99dee823 1// Copyright (C) 2020-2021 Free Software Foundation, Inc.
12324b9a
FD
2//
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)
7// any later version.
8
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.
13
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/>.
17
18// { dg-do compile { target c++11 } }
19
20#include <unordered_set>
21
22using type1 = std::unordered_multiset<int>;
23
24static_assert(std::is_nothrow_default_constructible<type1>::value,
25 "noexcept default constructible");
26
27struct not_noexcept_dflt_cons_hash
28{
29 not_noexcept_dflt_cons_hash() /* noexcept */;
30
31 std::size_t
32 operator()(int) const noexcept;
33};
34
35using type2 = std::unordered_multiset<int, not_noexcept_dflt_cons_hash>;
36
37static_assert( !std::is_nothrow_default_constructible<type2>::value,
38 "not noexcept default constructible");
39
40struct not_noexcept_dflt_cons_equal_to
41{
42 not_noexcept_dflt_cons_equal_to() /* noexcept */;
43
44 bool
45 operator()(int, int) const noexcept;
46};
47
48using type3 = std::unordered_multiset<int, std::hash<int>,
49 not_noexcept_dflt_cons_equal_to>;
50
51static_assert( !std::is_nothrow_default_constructible<type3>::value,
52 "not noexcept default constructible");
53
54template<typename _Tp>
55 struct not_noexcept_dflt_cons_alloc : std::allocator<_Tp>
56 {
57 not_noexcept_dflt_cons_alloc() /* noexcept */;
58
59 template<typename _Tp1>
60 struct rebind
61 { typedef not_noexcept_dflt_cons_alloc<_Tp1> other; };
62 };
63
64using type4 = std::unordered_multiset<int, std::hash<int>, std::equal_to<int>,
357beca8 65 not_noexcept_dflt_cons_alloc<int>>;
12324b9a
FD
66
67static_assert(!std::is_nothrow_default_constructible<type4>::value,
68 "not noexcept default constructible");