has_nothrow_copy_assign hooked up to clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113364 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
99ad765261
commit
27031115bf
@ -13,29 +13,17 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
template <class T, bool Result>
|
||||
void test_has_nothrow_assign()
|
||||
{
|
||||
static_assert( std::has_nothrow_copy_assign<T>::value, "");
|
||||
static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
|
||||
static_assert( std::has_nothrow_copy_assign<volatile T>::value, "");
|
||||
static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void test_has_not_nothrow_assign()
|
||||
{
|
||||
static_assert(!std::has_nothrow_copy_assign<T>::value, "");
|
||||
static_assert(!std::has_nothrow_copy_assign<const T>::value, "");
|
||||
static_assert(!std::has_nothrow_copy_assign<volatile T>::value, "");
|
||||
static_assert(!std::has_nothrow_copy_assign<const volatile T>::value, "");
|
||||
static_assert(std::has_nothrow_copy_assign<T>::value == Result, "");
|
||||
}
|
||||
|
||||
class Empty
|
||||
{
|
||||
};
|
||||
|
||||
class NotEmpty
|
||||
struct NotEmpty
|
||||
{
|
||||
virtual ~NotEmpty();
|
||||
};
|
||||
@ -47,7 +35,7 @@ struct bit_zero
|
||||
int : 0;
|
||||
};
|
||||
|
||||
class Abstract
|
||||
struct Abstract
|
||||
{
|
||||
virtual ~Abstract() = 0;
|
||||
};
|
||||
@ -59,19 +47,19 @@ struct A
|
||||
|
||||
int main()
|
||||
{
|
||||
test_has_not_nothrow_assign<void>();
|
||||
test_has_not_nothrow_assign<A>();
|
||||
test_has_not_nothrow_assign<int&>();
|
||||
test_has_nothrow_assign<void, false>();
|
||||
test_has_nothrow_assign<A, false>();
|
||||
test_has_nothrow_assign<int&, false>();
|
||||
test_has_nothrow_assign<Abstract, false>();
|
||||
test_has_nothrow_assign<char[3], false>();
|
||||
test_has_nothrow_assign<char[], false>();
|
||||
|
||||
test_has_nothrow_assign<Union>();
|
||||
test_has_nothrow_assign<Abstract>();
|
||||
test_has_nothrow_assign<Empty>();
|
||||
test_has_nothrow_assign<int>();
|
||||
test_has_nothrow_assign<double>();
|
||||
test_has_nothrow_assign<int*>();
|
||||
test_has_nothrow_assign<const int*>();
|
||||
test_has_nothrow_assign<char[3]>();
|
||||
test_has_nothrow_assign<char[3]>();
|
||||
test_has_nothrow_assign<NotEmpty>();
|
||||
test_has_nothrow_assign<bit_zero>();
|
||||
test_has_nothrow_assign<Union, true>();
|
||||
test_has_nothrow_assign<Empty, true>();
|
||||
test_has_nothrow_assign<int, true>();
|
||||
test_has_nothrow_assign<double, true>();
|
||||
test_has_nothrow_assign<int*, true>();
|
||||
test_has_nothrow_assign<const int*, true>();
|
||||
test_has_nothrow_assign<NotEmpty, true>();
|
||||
test_has_nothrow_assign<bit_zero, true>();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user