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 //===----------------------------------------------------------------------===//
8 
9 // type_traits
10 
11 // is_move_assignable
12 
13 #include <type_traits>
14 #include "test_macros.h"
15 
16 template <class T>
test_is_move_assignable()17 void test_is_move_assignable()
18 {
19     static_assert(( std::is_move_assignable<T>::value), "");
20 #if TEST_STD_VER > 14
21     static_assert(( std::is_move_assignable_v<T>), "");
22 #endif
23 }
24 
25 template <class T>
test_is_not_move_assignable()26 void test_is_not_move_assignable()
27 {
28     static_assert((!std::is_move_assignable<T>::value), "");
29 #if TEST_STD_VER > 14
30     static_assert((!std::is_move_assignable_v<T>), "");
31 #endif
32 }
33 
34 class Empty
35 {
36 };
37 
38 class NotEmpty
39 {
40 public:
41     virtual ~NotEmpty();
42 };
43 
44 union Union {};
45 
46 struct bit_zero
47 {
48     int :  0;
49 };
50 
51 struct A
52 {
53     A();
54 };
55 
main(int,char **)56 int main(int, char**)
57 {
58     test_is_move_assignable<int> ();
59     test_is_move_assignable<A> ();
60     test_is_move_assignable<bit_zero> ();
61     test_is_move_assignable<Union> ();
62     test_is_move_assignable<NotEmpty> ();
63     test_is_move_assignable<Empty> ();
64 
65     test_is_not_move_assignable<const int> ();
66     test_is_not_move_assignable<int[]> ();
67     test_is_not_move_assignable<int[3]> ();
68 
69     test_is_not_move_assignable<void> ();
70 
71   return 0;
72 }
73