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