]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/containers/unord/unord.multiset/unord.multiset.cnstr/dtor_noexcept.pass.cpp
Import libc++ 3.7.0 release (r246257).
[FreeBSD/FreeBSD.git] / test / std / containers / unord / unord.multiset / unord.multiset.cnstr / dtor_noexcept.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <unordered_set>
11
12 // ~unordered_multiset() // implied noexcept;
13
14 #include <unordered_set>
15 #include <cassert>
16
17 #include "MoveOnly.h"
18 #include "test_allocator.h"
19
20 #if __has_feature(cxx_noexcept)
21
22 template <class T>
23 struct some_comp
24 {
25     typedef T value_type;
26     ~some_comp() noexcept(false);
27 };
28
29 template <class T>
30 struct some_hash
31 {
32     typedef T value_type;
33     some_hash();
34     some_hash(const some_hash&);
35     ~some_hash() noexcept(false);
36 };
37
38 #endif
39
40 int main()
41 {
42 #if __has_feature(cxx_noexcept)
43     {
44         typedef std::unordered_multiset<MoveOnly> C;
45         static_assert(std::is_nothrow_destructible<C>::value, "");
46     }
47     {
48         typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
49                            std::equal_to<MoveOnly>, test_allocator<MoveOnly>> C;
50         static_assert(std::is_nothrow_destructible<C>::value, "");
51     }
52     {
53         typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
54                           std::equal_to<MoveOnly>, other_allocator<MoveOnly>> C;
55         static_assert(std::is_nothrow_destructible<C>::value, "");
56     }
57     {
58         typedef std::unordered_multiset<MoveOnly, some_hash<MoveOnly>> C;
59         static_assert(!std::is_nothrow_destructible<C>::value, "");
60     }
61     {
62         typedef std::unordered_multiset<MoveOnly, std::hash<MoveOnly>,
63                                                          some_comp<MoveOnly>> C;
64         static_assert(!std::is_nothrow_destructible<C>::value, "");
65     }
66 #endif
67 }