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// has_nothrow_move_assign
13
14#include <type_traits>
15
16template <class T>
17void test_has_nothrow_assign()
18{
19    static_assert( std::is_nothrow_move_assignable<T>::value, "");
20}
21
22template <class T>
23void test_has_not_nothrow_assign()
24{
25    static_assert(!std::is_nothrow_move_assignable<T>::value, "");
26}
27
28class Empty
29{
30};
31
32struct NotEmpty
33{
34    virtual ~NotEmpty();
35};
36
37union Union {};
38
39struct bit_zero
40{
41    int :  0;
42};
43
44struct A
45{
46    A& operator=(const A&);
47};
48
49int main()
50{
51    test_has_nothrow_assign<int&>();
52    test_has_nothrow_assign<Union>();
53    test_has_nothrow_assign<Empty>();
54    test_has_nothrow_assign<int>();
55    test_has_nothrow_assign<double>();
56    test_has_nothrow_assign<int*>();
57    test_has_nothrow_assign<const int*>();
58    test_has_nothrow_assign<NotEmpty>();
59    test_has_nothrow_assign<bit_zero>();
60
61    test_has_not_nothrow_assign<void>();
62    test_has_not_nothrow_assign<A>();
63}
64