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)
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)
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)
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)
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();
57 int no_decltype_incomplete_return_types();
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)
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();
81 int no_trailing_return();
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)
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();
105 int no_static_assert();
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();
116 int no_deleted_functions();
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();
127 int no_defaulted_functions();
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();
138 int no_rvalue_references();
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();
150 int no_variadic_templates();
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();
162 int no_inline_namespaces();
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)
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();
186 int no_reference_qualified_functions();
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();
197 int no_default_function_template_args();
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)
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();
219 int no_override_control();
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();
230 int no_alias_templates();
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();
241 int no_implicit_moves();
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)
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)
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();
274 int no_raw_string_literals();
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();
285 int no_unicode_literals();
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)
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();
307 int no_constexpr_string_builtins();
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();
318 int no_generalized_initializers();
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();
329 int no_unrestricted_unions();
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();
340 int no_user_literals();
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();
351 int no_local_type_template_args();
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();
362 int no_inheriting_constructors();
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();
373 int no_thread_local();
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();
387 int no_binary_literals();
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();
398 int no_aggregate_nsdmi();
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();
409 int no_return_type_deduction();
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();
420 int no_contextual_conversions();
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();
431 int no_relaxed_constexpr();
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();
442 int no_variable_templates();
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();
453 int no_init_captures();
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();
464 int no_decltype_auto();
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();
475 int no_generic_lambdas();
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