[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / move_assign_noexcept.pass.cpp
blobc40d1e557267feb9c78b2a8177edfbddcbd2245d
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <vector>
11 // vector& operator=(vector&& c)
12 // noexcept(
13 // allocator_type::propagate_on_container_move_assignment::value &&
14 // is_nothrow_move_assignable<allocator_type>::value);
16 // This tests a conforming extension
18 // UNSUPPORTED: c++03
20 #include <vector>
21 #include <cassert>
23 #include "test_macros.h"
24 #include "test_allocator.h"
26 template <class T>
27 struct some_alloc
29 typedef T value_type;
30 some_alloc(const some_alloc&);
33 template <class T>
34 struct some_alloc2
36 typedef T value_type;
38 some_alloc2() {}
39 some_alloc2(const some_alloc2&);
40 void deallocate(void*, unsigned) {}
42 typedef std::false_type propagate_on_container_move_assignment;
43 typedef std::true_type is_always_equal;
46 template <class T>
47 struct some_alloc3
49 typedef T value_type;
51 some_alloc3() {}
52 some_alloc3(const some_alloc3&);
53 void deallocate(void*, unsigned) {}
55 typedef std::false_type propagate_on_container_move_assignment;
56 typedef std::false_type is_always_equal;
59 int main(int, char**)
61 #if defined(_LIBCPP_VERSION)
63 typedef std::vector<bool> C;
64 static_assert(std::is_nothrow_move_assignable<C>::value, "");
66 #endif // _LIBCPP_VERSION
68 typedef std::vector<bool, test_allocator<bool>> C;
69 static_assert(!std::is_nothrow_move_assignable<C>::value, "");
71 #if defined(_LIBCPP_VERSION)
73 typedef std::vector<bool, other_allocator<bool>> C;
74 static_assert(std::is_nothrow_move_assignable<C>::value, "");
76 #endif // _LIBCPP_VERSION
78 #if TEST_STD_VER > 14
79 #if defined(_LIBCPP_VERSION)
80 typedef std::vector<bool, some_alloc<bool>> C;
81 static_assert( std::is_nothrow_move_assignable<C>::value, "");
82 #endif // _LIBCPP_VERSION
83 #else
84 typedef std::vector<bool, some_alloc<bool>> C;
85 static_assert(!std::is_nothrow_move_assignable<C>::value, "");
86 #endif
88 #if TEST_STD_VER > 14
89 #if defined(_LIBCPP_VERSION)
90 { // POCMA false, is_always_equal true
91 typedef std::vector<bool, some_alloc2<bool>> C;
92 static_assert( std::is_nothrow_move_assignable<C>::value, "");
94 #endif // _LIBCPP_VERSION
95 { // POCMA false, is_always_equal false
96 typedef std::vector<bool, some_alloc3<bool>> C;
97 static_assert(!std::is_nothrow_move_assignable<C>::value, "");
99 #endif
101 return 0;