is_copy_constructible.pass.cpp revision 1468b668aa964beb1220e9b36162b092fb54952b
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, bool Result>
17void test_is_copy_constructible()
18{
19    static_assert(std::is_copy_constructible<T>::value == Result, "");
20}
21
22class Empty
23{
24};
25
26class NotEmpty
27{
28public:
29    virtual ~NotEmpty();
30};
31
32union Union {};
33
34struct bit_zero
35{
36    int :  0;
37};
38
39class Abstract
40{
41public:
42    virtual ~Abstract() = 0;
43};
44
45struct A
46{
47    A(const A&);
48};
49
50int main()
51{
52    test_is_copy_constructible<char[3], false>();
53    test_is_copy_constructible<char[], false>();
54    test_is_copy_constructible<void, false>();
55    test_is_copy_constructible<Abstract, false>();
56
57    test_is_copy_constructible<A, true>();
58    test_is_copy_constructible<int&, true>();
59    test_is_copy_constructible<Union, true>();
60    test_is_copy_constructible<Empty, true>();
61    test_is_copy_constructible<int, true>();
62    test_is_copy_constructible<double, true>();
63    test_is_copy_constructible<int*, true>();
64    test_is_copy_constructible<const int*, true>();
65    test_is_copy_constructible<NotEmpty, true>();
66    test_is_copy_constructible<bit_zero, true>();
67}
68