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