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