has_feature_cxx0x.cpp revision e87c5bd593b038baec7cfa6075f26cd0ac256042
1// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s
2// RUN: %clang_cc1 -E -triple armv7-apple-darwin -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-NO-TLS %s
3// RUN: %clang_cc1 -E -triple x86_64-linux-gnu %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
4
5#if __has_feature(cxx_atomic)
6int has_atomic();
7#else
8int no_atomic();
9#endif
10
11// CHECK-0X: has_atomic
12// CHECK-NO-0X: no_atomic
13
14#if __has_feature(cxx_lambdas)
15int has_lambdas();
16#else
17int no_lambdas();
18#endif
19
20// CHECK-0X: has_lambdas
21// CHECK-NO-0X: no_lambdas
22
23
24#if __has_feature(cxx_nullptr)
25int has_nullptr();
26#else
27int no_nullptr();
28#endif
29
30// CHECK-0X: has_nullptr
31// CHECK-NO-0X: no_nullptr
32
33
34#if __has_feature(cxx_decltype)
35int has_decltype();
36#else
37int no_decltype();
38#endif
39
40// CHECK-0X: has_decltype
41// CHECK-NO-0X: no_decltype
42
43
44#if __has_feature(cxx_decltype_incomplete_return_types)
45int has_decltype_incomplete_return_types();
46#else
47int no_decltype_incomplete_return_types();
48#endif
49
50// CHECK-0X: has_decltype_incomplete_return_types
51// CHECK-NO-0X: no_decltype_incomplete_return_types
52
53
54#if __has_feature(cxx_auto_type)
55int has_auto_type();
56#else
57int no_auto_type();
58#endif
59
60// CHECK-0X: has_auto_type
61// CHECK-NO-0X: no_auto_type
62
63
64#if __has_feature(cxx_trailing_return)
65int has_trailing_return();
66#else
67int no_trailing_return();
68#endif
69
70// CHECK-0X: has_trailing_return
71// CHECK-NO-0X: no_trailing_return
72
73
74#if __has_feature(cxx_attributes)
75int has_attributes();
76#else
77int no_attributes();
78#endif
79
80// CHECK-0X: has_attributes
81// CHECK-NO-0X: no_attributes
82
83
84#if __has_feature(cxx_static_assert)
85int has_static_assert();
86#else
87int no_static_assert();
88#endif
89
90// CHECK-0X: has_static_assert
91// CHECK-NO-0X: no_static_assert
92
93#if __has_feature(cxx_deleted_functions)
94int has_deleted_functions();
95#else
96int no_deleted_functions();
97#endif
98
99// CHECK-0X: has_deleted_functions
100// CHECK-NO-0X: no_deleted_functions
101
102#if __has_feature(cxx_defaulted_functions)
103int has_defaulted_functions();
104#else
105int no_defaulted_functions();
106#endif
107
108// CHECK-0X: has_defaulted_functions
109// CHECK-NO-0X: no_defaulted_functions
110
111#if __has_feature(cxx_rvalue_references)
112int has_rvalue_references();
113#else
114int no_rvalue_references();
115#endif
116
117// CHECK-0X: has_rvalue_references
118// CHECK-NO-0X: no_rvalue_references
119
120
121#if __has_feature(cxx_variadic_templates)
122int has_variadic_templates();
123#else
124int no_variadic_templates();
125#endif
126
127// CHECK-0X: has_variadic_templates
128// CHECK-NO-0X: no_variadic_templates
129
130
131#if __has_feature(cxx_inline_namespaces)
132int has_inline_namespaces();
133#else
134int no_inline_namespaces();
135#endif
136
137// CHECK-0X: has_inline_namespaces
138// CHECK-NO-0X: no_inline_namespaces
139
140
141#if __has_feature(cxx_range_for)
142int has_range_for();
143#else
144int no_range_for();
145#endif
146
147// CHECK-0X: has_range_for
148// CHECK-NO-0X: no_range_for
149
150
151#if __has_feature(cxx_reference_qualified_functions)
152int has_reference_qualified_functions();
153#else
154int no_reference_qualified_functions();
155#endif
156
157// CHECK-0X: has_reference_qualified_functions
158// CHECK-NO-0X: no_reference_qualified_functions
159
160#if __has_feature(cxx_default_function_template_args)
161int has_default_function_template_args();
162#else
163int no_default_function_template_args();
164#endif
165
166// CHECK-0X: has_default_function_template_args
167// CHECK-NO-0X: no_default_function_template_args
168
169#if __has_feature(cxx_noexcept)
170int has_noexcept();
171#else
172int no_noexcept();
173#endif
174
175// CHECK-0X: has_noexcept
176// CHECK-NO-0X: no_noexcept
177
178#if __has_feature(cxx_override_control)
179int has_override_control();
180#else
181int no_override_control();
182#endif
183
184// CHECK-0X: has_override_control
185// CHECK-NO-0X: no_override_control
186
187#if __has_feature(cxx_alias_templates)
188int has_alias_templates();
189#else
190int no_alias_templates();
191#endif
192
193// CHECK-0X: has_alias_templates
194// CHECK-NO-0X: no_alias_templates
195
196#if __has_feature(cxx_implicit_moves)
197int has_implicit_moves();
198#else
199int no_implicit_moves();
200#endif
201
202// CHECK-0X: has_implicit_moves
203// CHECK-NO-0X: no_implicit_moves
204
205#if __has_feature(cxx_alignas)
206int has_alignas();
207#else
208int no_alignas();
209#endif
210
211// CHECK-0X: has_alignas
212// CHECK-NO-0X: no_alignas
213
214#if __has_feature(cxx_raw_string_literals)
215int has_raw_string_literals();
216#else
217int no_raw_string_literals();
218#endif
219
220// CHECK-0X: has_raw_string_literals
221// CHECK-NO-0X: no_raw_string_literals
222
223#if __has_feature(cxx_unicode_literals)
224int has_unicode_literals();
225#else
226int no_unicode_literals();
227#endif
228
229// CHECK-0X: has_unicode_literals
230// CHECK-NO-0X: no_unicode_literals
231
232#if __has_feature(cxx_constexpr)
233int has_constexpr();
234#else
235int no_constexpr();
236#endif
237
238// CHECK-0X: has_constexpr
239// CHECK-NO-0X: no_constexpr
240
241#if __has_feature(cxx_generalized_initializers)
242int has_generalized_initializers();
243#else
244int no_generalized_initializers();
245#endif
246
247// CHECK-0X: has_generalized_initializers
248// CHECK-NO-0X: no_generalized_initializers
249
250#if __has_feature(cxx_unrestricted_unions)
251int has_unrestricted_unions();
252#else
253int no_unrestricted_unions();
254#endif
255
256// CHECK-0X: has_unrestricted_unions
257// CHECK-NO-0X: no_unrestricted_unions
258
259#if __has_feature(cxx_user_literals)
260int has_user_literals();
261#else
262int no_user_literals();
263#endif
264
265// CHECK-0X: has_user_literals
266// CHECK-NO-0X: no_user_literals
267
268#if __has_feature(cxx_local_type_template_args)
269int has_local_type_template_args();
270#else
271int no_local_type_template_args();
272#endif
273
274// CHECK-0X: has_local_type_template_args
275// CHECK-NO-0X: no_local_type_template_args
276
277#if __has_feature(cxx_inheriting_constructors)
278int has_inheriting_constructors();
279#else
280int no_inheriting_constructors();
281#endif
282
283// CHECK-0X: has_inheriting_constructors
284// CHECK-NO-0X: no_inheriting_constructors
285
286#if __has_feature(cxx_thread_local)
287int has_thread_local();
288#else
289int no_thread_local();
290#endif
291
292// CHECK-0X: has_thread_local
293// CHECK-NO-0X: no_thread_local
294// CHECK-NO-TLS: no_thread_local
295