1 | // RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-11 %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 -std=c++98 %s -o - | FileCheck --check-prefix=CHECK-NO-11 %s |
4 | // RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++14 %s -o - | FileCheck --check-prefix=CHECK-14 %s |
5 | // RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++1z %s -o - | FileCheck --check-prefix=CHECK-1Z %s |
6 | |
7 | #if __has_feature(cxx_atomic) |
8 | int has_atomic(); |
9 | #else |
10 | int no_atomic(); |
11 | #endif |
12 | |
13 | // CHECK-1Z: has_atomic |
14 | // CHECK-14: has_atomic |
15 | // CHECK-11: has_atomic |
16 | // CHECK-NO-11: no_atomic |
17 | |
18 | #if __has_feature(cxx_lambdas) |
19 | int has_lambdas(); |
20 | #else |
21 | int no_lambdas(); |
22 | #endif |
23 | |
24 | // CHECK-1Z: has_lambdas |
25 | // CHECK-14: has_lambdas |
26 | // CHECK-11: has_lambdas |
27 | // CHECK-NO-11: no_lambdas |
28 | |
29 | |
30 | #if __has_feature(cxx_nullptr) |
31 | int has_nullptr(); |
32 | #else |
33 | int no_nullptr(); |
34 | #endif |
35 | |
36 | // CHECK-1Z: has_nullptr |
37 | // CHECK-14: has_nullptr |
38 | // CHECK-11: has_nullptr |
39 | // CHECK-NO-11: no_nullptr |
40 | |
41 | |
42 | #if __has_feature(cxx_decltype) |
43 | int has_decltype(); |
44 | #else |
45 | int no_decltype(); |
46 | #endif |
47 | |
48 | // CHECK-1Z: has_decltype |
49 | // CHECK-14: has_decltype |
50 | // CHECK-11: has_decltype |
51 | // CHECK-NO-11: no_decltype |
52 | |
53 | |
54 | #if __has_feature(cxx_decltype_incomplete_return_types) |
55 | int has_decltype_incomplete_return_types(); |
56 | #else |
57 | int no_decltype_incomplete_return_types(); |
58 | #endif |
59 | |
60 | // CHECK-1Z: has_decltype_incomplete_return_types |
61 | // CHECK-14: has_decltype_incomplete_return_types |
62 | // CHECK-11: has_decltype_incomplete_return_types |
63 | // CHECK-NO-11: no_decltype_incomplete_return_types |
64 | |
65 | |
66 | #if __has_feature(cxx_auto_type) |
67 | int has_auto_type(); |
68 | #else |
69 | int no_auto_type(); |
70 | #endif |
71 | |
72 | // CHECK-1Z: has_auto_type |
73 | // CHECK-14: has_auto_type |
74 | // CHECK-11: has_auto_type |
75 | // CHECK-NO-11: no_auto_type |
76 | |
77 | |
78 | #if __has_feature(cxx_trailing_return) |
79 | int has_trailing_return(); |
80 | #else |
81 | int no_trailing_return(); |
82 | #endif |
83 | |
84 | // CHECK-1Z: has_trailing_return |
85 | // CHECK-14: has_trailing_return |
86 | // CHECK-11: has_trailing_return |
87 | // CHECK-NO-11: no_trailing_return |
88 | |
89 | |
90 | #if __has_feature(cxx_attributes) |
91 | int has_attributes(); |
92 | #else |
93 | int no_attributes(); |
94 | #endif |
95 | |
96 | // CHECK-1Z: has_attributes |
97 | // CHECK-14: has_attributes |
98 | // CHECK-11: has_attributes |
99 | // CHECK-NO-11: no_attributes |
100 | |
101 | |
102 | #if __has_feature(cxx_static_assert) |
103 | int has_static_assert(); |
104 | #else |
105 | int no_static_assert(); |
106 | #endif |
107 | |
108 | // CHECK-1Z: has_static_assert |
109 | // CHECK-14: has_static_assert |
110 | // CHECK-11: has_static_assert |
111 | // CHECK-NO-11: no_static_assert |
112 | |
113 | #if __has_feature(cxx_deleted_functions) |
114 | int has_deleted_functions(); |
115 | #else |
116 | int no_deleted_functions(); |
117 | #endif |
118 | |
119 | // CHECK-1Z: has_deleted_functions |
120 | // CHECK-14: has_deleted_functions |
121 | // CHECK-11: has_deleted_functions |
122 | // CHECK-NO-11: no_deleted_functions |
123 | |
124 | #if __has_feature(cxx_defaulted_functions) |
125 | int has_defaulted_functions(); |
126 | #else |
127 | int no_defaulted_functions(); |
128 | #endif |
129 | |
130 | // CHECK-1Z: has_defaulted_functions |
131 | // CHECK-14: has_defaulted_functions |
132 | // CHECK-11: has_defaulted_functions |
133 | // CHECK-NO-11: no_defaulted_functions |
134 | |
135 | #if __has_feature(cxx_rvalue_references) |
136 | int has_rvalue_references(); |
137 | #else |
138 | int no_rvalue_references(); |
139 | #endif |
140 | |
141 | // CHECK-1Z: has_rvalue_references |
142 | // CHECK-14: has_rvalue_references |
143 | // CHECK-11: has_rvalue_references |
144 | // CHECK-NO-11: no_rvalue_references |
145 | |
146 | |
147 | #if __has_feature(cxx_variadic_templates) |
148 | int has_variadic_templates(); |
149 | #else |
150 | int no_variadic_templates(); |
151 | #endif |
152 | |
153 | // CHECK-1Z: has_variadic_templates |
154 | // CHECK-14: has_variadic_templates |
155 | // CHECK-11: has_variadic_templates |
156 | // CHECK-NO-11: no_variadic_templates |
157 | |
158 | |
159 | #if __has_feature(cxx_inline_namespaces) |
160 | int has_inline_namespaces(); |
161 | #else |
162 | int no_inline_namespaces(); |
163 | #endif |
164 | |
165 | // CHECK-1Z: has_inline_namespaces |
166 | // CHECK-14: has_inline_namespaces |
167 | // CHECK-11: has_inline_namespaces |
168 | // CHECK-NO-11: no_inline_namespaces |
169 | |
170 | |
171 | #if __has_feature(cxx_range_for) |
172 | int has_range_for(); |
173 | #else |
174 | int no_range_for(); |
175 | #endif |
176 | |
177 | // CHECK-1Z: has_range_for |
178 | // CHECK-14: has_range_for |
179 | // CHECK-11: has_range_for |
180 | // CHECK-NO-11: no_range_for |
181 | |
182 | |
183 | #if __has_feature(cxx_reference_qualified_functions) |
184 | int has_reference_qualified_functions(); |
185 | #else |
186 | int no_reference_qualified_functions(); |
187 | #endif |
188 | |
189 | // CHECK-1Z: has_reference_qualified_functions |
190 | // CHECK-14: has_reference_qualified_functions |
191 | // CHECK-11: has_reference_qualified_functions |
192 | // CHECK-NO-11: no_reference_qualified_functions |
193 | |
194 | #if __has_feature(cxx_default_function_template_args) |
195 | int has_default_function_template_args(); |
196 | #else |
197 | int no_default_function_template_args(); |
198 | #endif |
199 | |
200 | // CHECK-1Z: has_default_function_template_args |
201 | // CHECK-14: has_default_function_template_args |
202 | // CHECK-11: has_default_function_template_args |
203 | // CHECK-NO-11: no_default_function_template_args |
204 | |
205 | #if __has_feature(cxx_noexcept) |
206 | int has_noexcept(); |
207 | #else |
208 | int no_noexcept(); |
209 | #endif |
210 | |
211 | // CHECK-1Z: has_noexcept |
212 | // CHECK-14: has_noexcept |
213 | // CHECK-11: has_noexcept |
214 | // CHECK-NO-11: no_noexcept |
215 | |
216 | #if __has_feature(cxx_override_control) |
217 | int has_override_control(); |
218 | #else |
219 | int no_override_control(); |
220 | #endif |
221 | |
222 | // CHECK-1Z: has_override_control |
223 | // CHECK-14: has_override_control |
224 | // CHECK-11: has_override_control |
225 | // CHECK-NO-11: no_override_control |
226 | |
227 | #if __has_feature(cxx_alias_templates) |
228 | int has_alias_templates(); |
229 | #else |
230 | int no_alias_templates(); |
231 | #endif |
232 | |
233 | // CHECK-1Z: has_alias_templates |
234 | // CHECK-14: has_alias_templates |
235 | // CHECK-11: has_alias_templates |
236 | // CHECK-NO-11: no_alias_templates |
237 | |
238 | #if __has_feature(cxx_implicit_moves) |
239 | int has_implicit_moves(); |
240 | #else |
241 | int no_implicit_moves(); |
242 | #endif |
243 | |
244 | // CHECK-1Z: has_implicit_moves |
245 | // CHECK-14: has_implicit_moves |
246 | // CHECK-11: has_implicit_moves |
247 | // CHECK-NO-11: no_implicit_moves |
248 | |
249 | #if __has_feature(cxx_alignas) |
250 | int has_alignas(); |
251 | #else |
252 | int no_alignas(); |
253 | #endif |
254 | |
255 | // CHECK-1Z: has_alignas |
256 | // CHECK-14: has_alignas |
257 | // CHECK-11: has_alignas |
258 | // CHECK-NO-11: no_alignas |
259 | |
260 | #if __has_feature(cxx_alignof) |
261 | int has_alignof(); |
262 | #else |
263 | int no_alignof(); |
264 | #endif |
265 | |
266 | // CHECK-1Z: has_alignof |
267 | // CHECK-14: has_alignof |
268 | // CHECK-11: has_alignof |
269 | // CHECK-NO-11: no_alignof |
270 | |
271 | #if __has_feature(cxx_raw_string_literals) |
272 | int has_raw_string_literals(); |
273 | #else |
274 | int no_raw_string_literals(); |
275 | #endif |
276 | |
277 | // CHECK-1Z: has_raw_string_literals |
278 | // CHECK-14: has_raw_string_literals |
279 | // CHECK-11: has_raw_string_literals |
280 | // CHECK-NO-11: no_raw_string_literals |
281 | |
282 | #if __has_feature(cxx_unicode_literals) |
283 | int has_unicode_literals(); |
284 | #else |
285 | int no_unicode_literals(); |
286 | #endif |
287 | |
288 | // CHECK-1Z: has_unicode_literals |
289 | // CHECK-14: has_unicode_literals |
290 | // CHECK-11: has_unicode_literals |
291 | // CHECK-NO-11: no_unicode_literals |
292 | |
293 | #if __has_feature(cxx_constexpr) |
294 | int has_constexpr(); |
295 | #else |
296 | int no_constexpr(); |
297 | #endif |
298 | |
299 | // CHECK-1Z: has_constexpr |
300 | // CHECK-14: has_constexpr |
301 | // CHECK-11: has_constexpr |
302 | // CHECK-NO-11: no_constexpr |
303 | |
304 | #if __has_feature(cxx_constexpr_string_builtins) |
305 | int has_constexpr_string_builtins(); |
306 | #else |
307 | int no_constexpr_string_builtins(); |
308 | #endif |
309 | |
310 | // CHECK-1Z: has_constexpr_string_builtins |
311 | // CHECK-14: has_constexpr_string_builtins |
312 | // CHECK-11: has_constexpr_string_builtins |
313 | // CHECK-NO-11: no_constexpr_string_builtins |
314 | |
315 | #if __has_feature(cxx_generalized_initializers) |
316 | int has_generalized_initializers(); |
317 | #else |
318 | int no_generalized_initializers(); |
319 | #endif |
320 | |
321 | // CHECK-1Z: has_generalized_initializers |
322 | // CHECK-14: has_generalized_initializers |
323 | // CHECK-11: has_generalized_initializers |
324 | // CHECK-NO-11: no_generalized_initializers |
325 | |
326 | #if __has_feature(cxx_unrestricted_unions) |
327 | int has_unrestricted_unions(); |
328 | #else |
329 | int no_unrestricted_unions(); |
330 | #endif |
331 | |
332 | // CHECK-1Z: has_unrestricted_unions |
333 | // CHECK-14: has_unrestricted_unions |
334 | // CHECK-11: has_unrestricted_unions |
335 | // CHECK-NO-11: no_unrestricted_unions |
336 | |
337 | #if __has_feature(cxx_user_literals) |
338 | int has_user_literals(); |
339 | #else |
340 | int no_user_literals(); |
341 | #endif |
342 | |
343 | // CHECK-1Z: has_user_literals |
344 | // CHECK-14: has_user_literals |
345 | // CHECK-11: has_user_literals |
346 | // CHECK-NO-11: no_user_literals |
347 | |
348 | #if __has_feature(cxx_local_type_template_args) |
349 | int has_local_type_template_args(); |
350 | #else |
351 | int no_local_type_template_args(); |
352 | #endif |
353 | |
354 | // CHECK-1Z: has_local_type_template_args |
355 | // CHECK-14: has_local_type_template_args |
356 | // CHECK-11: has_local_type_template_args |
357 | // CHECK-NO-11: no_local_type_template_args |
358 | |
359 | #if __has_feature(cxx_inheriting_constructors) |
360 | int has_inheriting_constructors(); |
361 | #else |
362 | int no_inheriting_constructors(); |
363 | #endif |
364 | |
365 | // CHECK-1Z: has_inheriting_constructors |
366 | // CHECK-14: has_inheriting_constructors |
367 | // CHECK-11: has_inheriting_constructors |
368 | // CHECK-NO-11: no_inheriting_constructors |
369 | |
370 | #if __has_feature(cxx_thread_local) |
371 | int has_thread_local(); |
372 | #else |
373 | int no_thread_local(); |
374 | #endif |
375 | |
376 | // CHECK-1Z: has_thread_local |
377 | // CHECK-14: has_thread_local |
378 | // CHECK-11: has_thread_local |
379 | // CHECK-NO-11: no_thread_local |
380 | // CHECK-NO-TLS: no_thread_local |
381 | |
382 | // === C++14 features === |
383 | |
384 | #if __has_feature(cxx_binary_literals) |
385 | int has_binary_literals(); |
386 | #else |
387 | int no_binary_literals(); |
388 | #endif |
389 | |
390 | // CHECK-1Z: has_binary_literals |
391 | // CHECK-14: has_binary_literals |
392 | // CHECK-11: no_binary_literals |
393 | // CHECK-NO-11: no_binary_literals |
394 | |
395 | #if __has_feature(cxx_aggregate_nsdmi) |
396 | int has_aggregate_nsdmi(); |
397 | #else |
398 | int no_aggregate_nsdmi(); |
399 | #endif |
400 | |
401 | // CHECK-1Z: has_aggregate_nsdmi |
402 | // CHECK-14: has_aggregate_nsdmi |
403 | // CHECK-11: no_aggregate_nsdmi |
404 | // CHECK-NO-11: no_aggregate_nsdmi |
405 | |
406 | #if __has_feature(cxx_return_type_deduction) |
407 | int has_return_type_deduction(); |
408 | #else |
409 | int no_return_type_deduction(); |
410 | #endif |
411 | |
412 | // CHECK-1Z: has_return_type_deduction |
413 | // CHECK-14: has_return_type_deduction |
414 | // CHECK-11: no_return_type_deduction |
415 | // CHECK-NO-11: no_return_type_deduction |
416 | |
417 | #if __has_feature(cxx_contextual_conversions) |
418 | int has_contextual_conversions(); |
419 | #else |
420 | int no_contextual_conversions(); |
421 | #endif |
422 | |
423 | // CHECK-1Z: has_contextual_conversions |
424 | // CHECK-14: has_contextual_conversions |
425 | // CHECK-11: no_contextual_conversions |
426 | // CHECK-NO-11: no_contextual_conversions |
427 | |
428 | #if __has_feature(cxx_relaxed_constexpr) |
429 | int has_relaxed_constexpr(); |
430 | #else |
431 | int no_relaxed_constexpr(); |
432 | #endif |
433 | |
434 | // CHECK-1Z: has_relaxed_constexpr |
435 | // CHECK-14: has_relaxed_constexpr |
436 | // CHECK-11: no_relaxed_constexpr |
437 | // CHECK-NO-11: no_relaxed_constexpr |
438 | |
439 | #if __has_feature(cxx_variable_templates) |
440 | int has_variable_templates(); |
441 | #else |
442 | int no_variable_templates(); |
443 | #endif |
444 | |
445 | // CHECK-1Z: has_variable_templates |
446 | // CHECK-14: has_variable_templates |
447 | // CHECK-11: no_variable_templates |
448 | // CHECK-NO-11: no_variable_templates |
449 | |
450 | #if __has_feature(cxx_init_captures) |
451 | int has_init_captures(); |
452 | #else |
453 | int no_init_captures(); |
454 | #endif |
455 | |
456 | // CHECK-1Z: has_init_captures |
457 | // CHECK-14: has_init_captures |
458 | // CHECK-11: no_init_captures |
459 | // CHECK-NO-11: no_init_captures |
460 | |
461 | #if __has_feature(cxx_decltype_auto) |
462 | int has_decltype_auto(); |
463 | #else |
464 | int no_decltype_auto(); |
465 | #endif |
466 | |
467 | // CHECK-1Z: has_decltype_auto |
468 | // CHECK-14: has_decltype_auto |
469 | // CHECK-11: no_decltype_auto |
470 | // CHECK-NO-11: no_decltype_auto |
471 | |
472 | #if __has_feature(cxx_generic_lambdas) |
473 | int has_generic_lambdas(); |
474 | #else |
475 | int no_generic_lambdas(); |
476 | #endif |
477 | |
478 | // CHECK-1Z: has_generic_lambdas |
479 | // CHECK-14: has_generic_lambdas |
480 | // CHECK-11: no_generic_lambdas |
481 | // CHECK-NO-11: no_generic_lambdas |
482 | |