has_nothrow_copy_assign hooked up to clang
llvm-svn: 113364
This commit is contained in:
parent
928d8294c2
commit
1be27f0929
|
@ -13,29 +13,17 @@
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
template <class T>
|
template <class T, bool Result>
|
||||||
void test_has_nothrow_assign()
|
void test_has_nothrow_assign()
|
||||||
{
|
{
|
||||||
static_assert( std::has_nothrow_copy_assign<T>::value, "");
|
static_assert(std::has_nothrow_copy_assign<T>::value == Result, "");
|
||||||
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, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Empty
|
class Empty
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotEmpty
|
struct NotEmpty
|
||||||
{
|
{
|
||||||
virtual ~NotEmpty();
|
virtual ~NotEmpty();
|
||||||
};
|
};
|
||||||
|
@ -47,7 +35,7 @@ struct bit_zero
|
||||||
int : 0;
|
int : 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Abstract
|
struct Abstract
|
||||||
{
|
{
|
||||||
virtual ~Abstract() = 0;
|
virtual ~Abstract() = 0;
|
||||||
};
|
};
|
||||||
|
@ -59,19 +47,19 @@ struct A
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test_has_not_nothrow_assign<void>();
|
test_has_nothrow_assign<void, false>();
|
||||||
test_has_not_nothrow_assign<A>();
|
test_has_nothrow_assign<A, false>();
|
||||||
test_has_not_nothrow_assign<int&>();
|
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<Union, true>();
|
||||||
test_has_nothrow_assign<Abstract>();
|
test_has_nothrow_assign<Empty, true>();
|
||||||
test_has_nothrow_assign<Empty>();
|
test_has_nothrow_assign<int, true>();
|
||||||
test_has_nothrow_assign<int>();
|
test_has_nothrow_assign<double, true>();
|
||||||
test_has_nothrow_assign<double>();
|
test_has_nothrow_assign<int*, true>();
|
||||||
test_has_nothrow_assign<int*>();
|
test_has_nothrow_assign<const int*, true>();
|
||||||
test_has_nothrow_assign<const int*>();
|
test_has_nothrow_assign<NotEmpty, true>();
|
||||||
test_has_nothrow_assign<char[3]>();
|
test_has_nothrow_assign<bit_zero, true>();
|
||||||
test_has_nothrow_assign<char[3]>();
|
|
||||||
test_has_nothrow_assign<NotEmpty>();
|
|
||||||
test_has_nothrow_assign<bit_zero>();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue