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// is_trivially_move_assignable
13
14// XFAIL: gcc-4.9
15
16#include <type_traits>
17#include "test_macros.h"
18
19template <class T>
20void test_has_trivial_assign()
21{
22    static_assert( std::is_trivially_move_assignable<T>::value, "");
23#if TEST_STD_VER > 14
24    static_assert( std::is_trivially_move_assignable_v<T>, "");
25#endif
26}
27
28template <class T>
29void test_has_not_trivial_assign()
30{
31    static_assert(!std::is_trivially_move_assignable<T>::value, "");
32#if TEST_STD_VER > 14
33    static_assert(!std::is_trivially_move_assignable_v<T>, "");
34#endif
35}
36
37class Empty
38{
39};
40
41class NotEmpty
42{
43    virtual ~NotEmpty();
44};
45
46union Union {};
47
48struct bit_zero
49{
50    int :  0;
51};
52
53class Abstract
54{
55    virtual ~Abstract() = 0;
56};
57
58struct A
59{
60    A& operator=(const A&);
61};
62
63int main()
64{
65    test_has_trivial_assign<int&>();
66    test_has_trivial_assign<Union>();
67    test_has_trivial_assign<Empty>();
68    test_has_trivial_assign<int>();
69    test_has_trivial_assign<double>();
70    test_has_trivial_assign<int*>();
71    test_has_trivial_assign<const int*>();
72    test_has_trivial_assign<bit_zero>();
73
74    test_has_not_trivial_assign<void>();
75    test_has_not_trivial_assign<A>();
76    test_has_not_trivial_assign<NotEmpty>();
77    test_has_not_trivial_assign<Abstract>();
78    test_has_not_trivial_assign<const Empty>();
79
80}
81