is_nothrow_copy_assignable.pass.cpp revision 1468b668aa964beb1220e9b36162b092fb54952b
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_nothrow_copy_assignable 13 14#include <type_traits> 15 16template <class T, bool Result> 17void test_has_nothrow_assign() 18{ 19 static_assert(std::is_nothrow_copy_assignable<T>::value == Result, ""); 20} 21 22class Empty 23{ 24}; 25 26struct NotEmpty 27{ 28 virtual ~NotEmpty(); 29}; 30 31union Union {}; 32 33struct bit_zero 34{ 35 int : 0; 36}; 37 38struct A 39{ 40 A& operator=(const A&); 41}; 42 43int main() 44{ 45 test_has_nothrow_assign<void, false>(); 46 test_has_nothrow_assign<A, false>(); 47 test_has_nothrow_assign<int&, true>(); 48 49 test_has_nothrow_assign<Union, true>(); 50 test_has_nothrow_assign<Empty, true>(); 51 test_has_nothrow_assign<int, true>(); 52 test_has_nothrow_assign<double, true>(); 53 test_has_nothrow_assign<int*, true>(); 54 test_has_nothrow_assign<const int*, true>(); 55 test_has_nothrow_assign<NotEmpty, true>(); 56 test_has_nothrow_assign<bit_zero, true>(); 57} 58