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 // <map>
11
12 // ~map() // implied noexcept;
13
14 // UNSUPPORTED: c++98, c++03
15
16 #include <map>
17 #include <cassert>
18
19 #include "test_macros.h"
20 #include "MoveOnly.h"
21 #include "test_allocator.h"
22
23 template <class T>
24 struct some_comp
25 {
26 typedef T value_type;
27 ~some_comp() noexcept(false);
operator ()some_comp28 bool operator()(const T&, const T&) const noexcept { return false; }
29 };
30
main()31 int main()
32 {
33 typedef std::pair<const MoveOnly, MoveOnly> V;
34 {
35 typedef std::map<MoveOnly, MoveOnly> C;
36 static_assert(std::is_nothrow_destructible<C>::value, "");
37 }
38 {
39 typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
40 static_assert(std::is_nothrow_destructible<C>::value, "");
41 }
42 {
43 typedef std::map<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
44 static_assert(std::is_nothrow_destructible<C>::value, "");
45 }
46 #if defined(_LIBCPP_VERSION)
47 {
48 typedef std::map<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
49 static_assert(!std::is_nothrow_destructible<C>::value, "");
50 }
51 #endif // _LIBCPP_VERSION
52 }
53