2010-08-22 00:59:46 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2010-11-16 22:09:02 +00:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-08-22 00:59:46 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// type_traits
|
|
|
|
|
2010-11-19 22:17:28 +00:00
|
|
|
// is_nothrow_copy_assignable
|
2010-08-22 00:59:46 +00:00
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
|
2013-07-04 00:10:01 +00:00
|
|
|
template <class T>
|
2010-08-22 00:59:46 +00:00
|
|
|
void test_has_nothrow_assign()
|
|
|
|
{
|
2013-07-04 00:10:01 +00:00
|
|
|
static_assert( std::is_nothrow_copy_assignable<T>::value, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
void test_has_not_nothrow_assign()
|
|
|
|
{
|
|
|
|
static_assert(!std::is_nothrow_copy_assignable<T>::value, "");
|
2010-08-22 00:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class Empty
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2010-09-08 16:39:18 +00:00
|
|
|
struct NotEmpty
|
2010-08-22 00:59:46 +00:00
|
|
|
{
|
|
|
|
virtual ~NotEmpty();
|
|
|
|
};
|
|
|
|
|
|
|
|
union Union {};
|
|
|
|
|
|
|
|
struct bit_zero
|
|
|
|
{
|
|
|
|
int : 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct A
|
|
|
|
{
|
|
|
|
A& operator=(const A&);
|
|
|
|
};
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2013-07-04 00:10:01 +00:00
|
|
|
test_has_nothrow_assign<int&>();
|
|
|
|
test_has_nothrow_assign<Union>();
|
|
|
|
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<NotEmpty>();
|
|
|
|
test_has_nothrow_assign<bit_zero>();
|
|
|
|
|
|
|
|
test_has_not_nothrow_assign<const int>();
|
|
|
|
test_has_not_nothrow_assign<void>();
|
|
|
|
test_has_not_nothrow_assign<A>();
|
|
|
|
|
2010-08-22 00:59:46 +00:00
|
|
|
}
|