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