[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Lexer / has_feature_cxx0x.cpp
blob9082ca848c6994ea8d7224dcddd70cc2cadb60d8
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
7 #if __has_feature(cxx_atomic)
8 int has_atomic();
9 #else
10 int no_atomic();
11 #endif
13 // CHECK-1Z: has_atomic
14 // CHECK-14: has_atomic
15 // CHECK-11: has_atomic
16 // CHECK-NO-11: no_atomic
18 #if __has_feature(cxx_lambdas)
19 int has_lambdas();
20 #else
21 int no_lambdas();
22 #endif
24 // CHECK-1Z: has_lambdas
25 // CHECK-14: has_lambdas
26 // CHECK-11: has_lambdas
27 // CHECK-NO-11: no_lambdas
30 #if __has_feature(cxx_nullptr)
31 int has_nullptr();
32 #else
33 int no_nullptr();
34 #endif
36 // CHECK-1Z: has_nullptr
37 // CHECK-14: has_nullptr
38 // CHECK-11: has_nullptr
39 // CHECK-NO-11: no_nullptr
42 #if __has_feature(cxx_decltype)
43 int has_decltype();
44 #else
45 int no_decltype();
46 #endif
48 // CHECK-1Z: has_decltype
49 // CHECK-14: has_decltype
50 // CHECK-11: has_decltype
51 // CHECK-NO-11: no_decltype
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
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
66 #if __has_feature(cxx_auto_type)
67 int has_auto_type();
68 #else
69 int no_auto_type();
70 #endif
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
78 #if __has_feature(cxx_trailing_return)
79 int has_trailing_return();
80 #else
81 int no_trailing_return();
82 #endif
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
90 #if __has_feature(cxx_attributes)
91 int has_attributes();
92 #else
93 int no_attributes();
94 #endif
96 // CHECK-1Z: has_attributes
97 // CHECK-14: has_attributes
98 // CHECK-11: has_attributes
99 // CHECK-NO-11: no_attributes
102 #if __has_feature(cxx_static_assert)
103 int has_static_assert();
104 #else
105 int no_static_assert();
106 #endif
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
113 #if __has_feature(cxx_deleted_functions)
114 int has_deleted_functions();
115 #else
116 int no_deleted_functions();
117 #endif
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
124 #if __has_feature(cxx_defaulted_functions)
125 int has_defaulted_functions();
126 #else
127 int no_defaulted_functions();
128 #endif
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
135 #if __has_feature(cxx_rvalue_references)
136 int has_rvalue_references();
137 #else
138 int no_rvalue_references();
139 #endif
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
147 #if __has_feature(cxx_variadic_templates)
148 int has_variadic_templates();
149 #else
150 int no_variadic_templates();
151 #endif
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
159 #if __has_feature(cxx_inline_namespaces)
160 int has_inline_namespaces();
161 #else
162 int no_inline_namespaces();
163 #endif
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
171 #if __has_feature(cxx_range_for)
172 int has_range_for();
173 #else
174 int no_range_for();
175 #endif
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
183 #if __has_feature(cxx_reference_qualified_functions)
184 int has_reference_qualified_functions();
185 #else
186 int no_reference_qualified_functions();
187 #endif
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
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
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
205 #if __has_feature(cxx_noexcept)
206 int has_noexcept();
207 #else
208 int no_noexcept();
209 #endif
211 // CHECK-1Z: has_noexcept
212 // CHECK-14: has_noexcept
213 // CHECK-11: has_noexcept
214 // CHECK-NO-11: no_noexcept
216 #if __has_feature(cxx_override_control)
217 int has_override_control();
218 #else
219 int no_override_control();
220 #endif
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
227 #if __has_feature(cxx_alias_templates)
228 int has_alias_templates();
229 #else
230 int no_alias_templates();
231 #endif
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
238 #if __has_feature(cxx_implicit_moves)
239 int has_implicit_moves();
240 #else
241 int no_implicit_moves();
242 #endif
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
249 #if __has_feature(cxx_alignas)
250 int has_alignas();
251 #else
252 int no_alignas();
253 #endif
255 // CHECK-1Z: has_alignas
256 // CHECK-14: has_alignas
257 // CHECK-11: has_alignas
258 // CHECK-NO-11: no_alignas
260 #if __has_feature(cxx_alignof)
261 int has_alignof();
262 #else
263 int no_alignof();
264 #endif
266 // CHECK-1Z: has_alignof
267 // CHECK-14: has_alignof
268 // CHECK-11: has_alignof
269 // CHECK-NO-11: no_alignof
271 #if __has_feature(cxx_raw_string_literals)
272 int has_raw_string_literals();
273 #else
274 int no_raw_string_literals();
275 #endif
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
282 #if __has_feature(cxx_unicode_literals)
283 int has_unicode_literals();
284 #else
285 int no_unicode_literals();
286 #endif
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
293 #if __has_feature(cxx_constexpr)
294 int has_constexpr();
295 #else
296 int no_constexpr();
297 #endif
299 // CHECK-1Z: has_constexpr
300 // CHECK-14: has_constexpr
301 // CHECK-11: has_constexpr
302 // CHECK-NO-11: no_constexpr
304 #if __has_feature(cxx_constexpr_string_builtins)
305 int has_constexpr_string_builtins();
306 #else
307 int no_constexpr_string_builtins();
308 #endif
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
315 #if __has_feature(cxx_generalized_initializers)
316 int has_generalized_initializers();
317 #else
318 int no_generalized_initializers();
319 #endif
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
326 #if __has_feature(cxx_unrestricted_unions)
327 int has_unrestricted_unions();
328 #else
329 int no_unrestricted_unions();
330 #endif
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
337 #if __has_feature(cxx_user_literals)
338 int has_user_literals();
339 #else
340 int no_user_literals();
341 #endif
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
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
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
359 #if __has_feature(cxx_inheriting_constructors)
360 int has_inheriting_constructors();
361 #else
362 int no_inheriting_constructors();
363 #endif
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
370 #if __has_feature(cxx_thread_local)
371 int has_thread_local();
372 #else
373 int no_thread_local();
374 #endif
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
382 // === C++14 features ===
384 #if __has_feature(cxx_binary_literals)
385 int has_binary_literals();
386 #else
387 int no_binary_literals();
388 #endif
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
395 #if __has_feature(cxx_aggregate_nsdmi)
396 int has_aggregate_nsdmi();
397 #else
398 int no_aggregate_nsdmi();
399 #endif
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
406 #if __has_feature(cxx_return_type_deduction)
407 int has_return_type_deduction();
408 #else
409 int no_return_type_deduction();
410 #endif
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
417 #if __has_feature(cxx_contextual_conversions)
418 int has_contextual_conversions();
419 #else
420 int no_contextual_conversions();
421 #endif
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
428 #if __has_feature(cxx_relaxed_constexpr)
429 int has_relaxed_constexpr();
430 #else
431 int no_relaxed_constexpr();
432 #endif
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
439 #if __has_feature(cxx_variable_templates)
440 int has_variable_templates();
441 #else
442 int no_variable_templates();
443 #endif
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
450 #if __has_feature(cxx_init_captures)
451 int has_init_captures();
452 #else
453 int no_init_captures();
454 #endif
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
461 #if __has_feature(cxx_decltype_auto)
462 int has_decltype_auto();
463 #else
464 int no_decltype_auto();
465 #endif
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
472 #if __has_feature(cxx_generic_lambdas)
473 int has_generic_lambdas();
474 #else
475 int no_generic_lambdas();
476 #endif
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