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 // type_traits
11 
12 // is_trivially_move_assignable
13 
14 #include <type_traits>
15 
16 template <class T>
test_has_trivial_assign()17 void test_has_trivial_assign()
18 {
19     static_assert( std::is_trivially_move_assignable<T>::value, "");
20 }
21 
22 template <class T>
test_has_not_trivial_assign()23 void test_has_not_trivial_assign()
24 {
25     static_assert(!std::is_trivially_move_assignable<T>::value, "");
26 }
27 
28 class Empty
29 {
30 };
31 
32 class NotEmpty
33 {
34     virtual ~NotEmpty();
35 };
36 
37 union Union {};
38 
39 struct bit_zero
40 {
41     int :  0;
42 };
43 
44 class Abstract
45 {
46     virtual ~Abstract() = 0;
47 };
48 
49 struct A
50 {
51     A& operator=(const A&);
52 };
53 
main()54 int main()
55 {
56     test_has_trivial_assign<int&>();
57     test_has_trivial_assign<Union>();
58     test_has_trivial_assign<Empty>();
59     test_has_trivial_assign<int>();
60     test_has_trivial_assign<double>();
61     test_has_trivial_assign<int*>();
62     test_has_trivial_assign<const int*>();
63     test_has_trivial_assign<bit_zero>();
64 
65     test_has_not_trivial_assign<void>();
66     test_has_not_trivial_assign<A>();
67     test_has_not_trivial_assign<NotEmpty>();
68     test_has_not_trivial_assign<Abstract>();
69     test_has_not_trivial_assign<const Empty>();
70 
71 }
72