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