1468b668aa
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119854 91177308-0d34-0410-b5e6-96231b3b80d8
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// type_traits
|
|
|
|
// is_nothrow_copy_assignable
|
|
|
|
#include <type_traits>
|
|
|
|
template <class T, bool Result>
|
|
void test_has_nothrow_assign()
|
|
{
|
|
static_assert(std::is_nothrow_copy_assignable<T>::value == Result, "");
|
|
}
|
|
|
|
class Empty
|
|
{
|
|
};
|
|
|
|
struct NotEmpty
|
|
{
|
|
virtual ~NotEmpty();
|
|
};
|
|
|
|
union Union {};
|
|
|
|
struct bit_zero
|
|
{
|
|
int : 0;
|
|
};
|
|
|
|
struct A
|
|
{
|
|
A& operator=(const A&);
|
|
};
|
|
|
|
int main()
|
|
{
|
|
test_has_nothrow_assign<void, false>();
|
|
test_has_nothrow_assign<A, false>();
|
|
test_has_nothrow_assign<int&, true>();
|
|
|
|
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>();
|
|
}
|