aboutsummaryrefslogtreecommitdiff
path: root/test/std/experimental/utilities/meta/meta.type.synop/meta.unary.cat.pass.cpp
blob: 2d1e706f67d22ac9681fcd337e62e7e1dc38d399 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// <experimental/type_traits>

#include <experimental/type_traits>

#if _LIBCPP_STD_VER > 11

namespace ex = std::experimental;

struct class_type {};
enum enum_type {};
union union_type {};

int main()
{
    {
        typedef void T;
        static_assert(ex::is_void_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_void_v<T>), const bool>::value, "");
        static_assert(ex::is_void_v<T> == std::is_void<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_void_v<T>, "");
        static_assert(ex::is_void_v<T> == std::is_void<T>::value, "");
    }
    {
        typedef decltype(nullptr) T;
        static_assert(ex::is_null_pointer_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_null_pointer_v<T>), const bool>::value, "");
        static_assert(ex::is_null_pointer_v<T> == std::is_null_pointer<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_null_pointer_v<T>, "");
        static_assert(ex::is_null_pointer_v<T> == std::is_null_pointer<T>::value, "");
    }
    {
        typedef int T;
        static_assert(ex::is_integral_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_integral_v<T>), const bool>::value, "");
        static_assert(ex::is_integral_v<T> == std::is_integral<T>::value, "");
    }
    {
        typedef void T;
        static_assert(!ex::is_integral_v<T>, "");
        static_assert(ex::is_integral_v<T> == std::is_integral<T>::value, "");
    }
    {
        typedef float T;
        static_assert(ex::is_floating_point_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_floating_point_v<T>), const bool>::value, "");
        static_assert(ex::is_floating_point_v<T> == std::is_floating_point<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_floating_point_v<T>, "");
        static_assert(ex::is_floating_point_v<T> == std::is_floating_point<T>::value, "");
    }
    {
        typedef int(T)[42];
        static_assert(ex::is_array_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_array_v<T>), const bool>::value, "");
        static_assert(ex::is_array_v<T> == std::is_array<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_array_v<T>, "");
        static_assert(ex::is_array_v<T> == std::is_array<T>::value, "");
    }
    {
        typedef void* T;
        static_assert(ex::is_pointer_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_pointer_v<T>), const bool>::value, "");
        static_assert(ex::is_pointer_v<T> == std::is_pointer<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_pointer_v<T>, "");
        static_assert(ex::is_pointer_v<T> == std::is_pointer<T>::value, "");
    }
    {
        typedef int & T;
        static_assert(ex::is_lvalue_reference_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_lvalue_reference_v<T>), const bool>::value, "");
        static_assert(ex::is_lvalue_reference_v<T> == std::is_lvalue_reference<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_lvalue_reference_v<T>, "");
        static_assert(ex::is_lvalue_reference_v<T> == std::is_lvalue_reference<T>::value, "");
    }
    {
        typedef int && T;
        static_assert(ex::is_rvalue_reference_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_rvalue_reference_v<T>), const bool>::value, "");
        static_assert(ex::is_rvalue_reference_v<T> == std::is_rvalue_reference<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_rvalue_reference_v<T>, "");
        static_assert(ex::is_rvalue_reference_v<T> == std::is_rvalue_reference<T>::value, "");
    }
    {
        typedef int class_type::*T;
        static_assert(ex::is_member_object_pointer_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_member_object_pointer_v<T>), const bool>::value, "");
        static_assert(ex::is_member_object_pointer_v<T> == std::is_member_object_pointer<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_member_object_pointer_v<T>, "");
        static_assert(ex::is_member_object_pointer_v<T> == std::is_member_object_pointer<T>::value, "");
    }
    {
        typedef void(class_type::*T)();
        static_assert(ex::is_member_function_pointer_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_member_function_pointer_v<T>), const bool>::value, "");
        static_assert(ex::is_member_function_pointer_v<T> == std::is_member_function_pointer<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_member_function_pointer_v<T>, "");
        static_assert(ex::is_member_function_pointer_v<T> == std::is_member_function_pointer<T>::value, "");
    }
    {
        typedef enum_type T;
        static_assert(ex::is_enum_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_enum_v<T>), const bool>::value, "");
        static_assert(ex::is_enum_v<T> == std::is_enum<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_enum_v<T>, "");
        static_assert(ex::is_enum_v<T> == std::is_enum<T>::value, "");
    }
    {
        typedef union_type T;
        static_assert(ex::is_union_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_union_v<T>), const bool>::value, "");
        static_assert(ex::is_union_v<T> == std::is_union<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_union_v<T>, "");
        static_assert(ex::is_union_v<T> == std::is_union<T>::value, "");
    }
    {
        typedef class_type T;
        static_assert(ex::is_class_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_class_v<T>), const bool>::value, "");
        static_assert(ex::is_class_v<T> == std::is_class<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_class_v<T>, "");
        static_assert(ex::is_class_v<T> == std::is_class<T>::value, "");
    }
    {
        typedef void(T)();
        static_assert(ex::is_function_v<T>, "");
        static_assert(std::is_same<decltype(ex::is_function_v<T>), const bool>::value, "");
        static_assert(ex::is_function_v<T> == std::is_function<T>::value, "");
    }
    {
        typedef int T;
        static_assert(!ex::is_function_v<T>, "");
        static_assert(ex::is_function_v<T> == std::is_function<T>::value, "");
    }
}
#else /* _LIBCPP_STD_VER <= 11 */
int main() {}
#endif /* _LIBCPP_STD_VER > 11 */