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_map>
11
12 // ~unordered_map() // implied noexcept;
13
14 #include <unordered_map>
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
main()40 int main()
41 {
42 #if __has_feature(cxx_noexcept)
43 {
44 typedef std::unordered_map<MoveOnly, MoveOnly> C;
45 static_assert(std::is_nothrow_destructible<C>::value, "");
46 }
47 {
48 typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
49 std::equal_to<MoveOnly>, test_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
50 static_assert(std::is_nothrow_destructible<C>::value, "");
51 }
52 {
53 typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
54 std::equal_to<MoveOnly>, other_allocator<std::pair<const MoveOnly, MoveOnly>>> C;
55 static_assert(std::is_nothrow_destructible<C>::value, "");
56 }
57 {
58 typedef std::unordered_map<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
59 static_assert(!std::is_nothrow_destructible<C>::value, "");
60 }
61 {
62 typedef std::unordered_map<MoveOnly, MoveOnly, std::hash<MoveOnly>,
63 some_comp<MoveOnly>> C;
64 static_assert(!std::is_nothrow_destructible<C>::value, "");
65 }
66 #endif
67 }
68