is_move_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_move_constructible
13
14#include <type_traits>
15
16template <class T, bool Result>
17void test_is_move_constructible()
18{
19    static_assert(std::is_move_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
50struct B
51{
52    B(B&&);
53};
54
55int main()
56{
57    test_is_move_constructible<char[3], false>();
58    test_is_move_constructible<char[], false>();
59    test_is_move_constructible<void, false>();
60    test_is_move_constructible<Abstract, false>();
61
62    test_is_move_constructible<A, true>();
63    test_is_move_constructible<int&, true>();
64    test_is_move_constructible<Union, true>();
65    test_is_move_constructible<Empty, true>();
66    test_is_move_constructible<int, true>();
67    test_is_move_constructible<double, true>();
68    test_is_move_constructible<int*, true>();
69    test_is_move_constructible<const int*, true>();
70    test_is_move_constructible<NotEmpty, true>();
71    test_is_move_constructible<bit_zero, true>();
72    test_is_move_constructible<B, true>();
73}
74