blob: 9fb05de31a23f9ce72d84394f376970ac911a383 [file] [log] [blame]
Richard Smith7f0ffb32013-05-07 19:32:56 +00001// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-11 %s
Douglas Gregore87c5bd2013-05-02 05:28:32 +00002// RUN: %clang_cc1 -E -triple armv7-apple-darwin -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-NO-TLS %s
Richard Smith7f0ffb32013-05-07 19:32:56 +00003// RUN: %clang_cc1 -E -triple x86_64-linux-gnu %s -o - | FileCheck --check-prefix=CHECK-NO-11 %s
4// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c++1y %s -o - | FileCheck --check-prefix=CHECK-1Y %s
Sean Hunt4ef4c6b2010-01-13 08:31:49 +00005
David Chisnall7a7ee302012-01-16 17:27:18 +00006#if __has_feature(cxx_atomic)
7int has_atomic();
8#else
9int no_atomic();
10#endif
11
Richard Smith7f0ffb32013-05-07 19:32:56 +000012// CHECK-1Y: has_atomic
13// CHECK-11: has_atomic
14// CHECK-NO-11: no_atomic
David Chisnall7a7ee302012-01-16 17:27:18 +000015
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000016#if __has_feature(cxx_lambdas)
Douglas Gregorc78e2592011-01-26 15:36:03 +000017int has_lambdas();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000018#else
19int no_lambdas();
20#endif
21
Richard Smith7f0ffb32013-05-07 19:32:56 +000022// CHECK-1Y: has_lambdas
23// CHECK-11: has_lambdas
24// CHECK-NO-11: no_lambdas
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000025
26
27#if __has_feature(cxx_nullptr)
Sean Hunt12484512010-01-13 08:58:42 +000028int has_nullptr();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000029#else
30int no_nullptr();
31#endif
32
Richard Smith7f0ffb32013-05-07 19:32:56 +000033// CHECK-1Y: has_nullptr
34// CHECK-11: has_nullptr
35// CHECK-NO-11: no_nullptr
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000036
37
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000038#if __has_feature(cxx_decltype)
Sean Hunt12484512010-01-13 08:58:42 +000039int has_decltype();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000040#else
41int no_decltype();
42#endif
43
Richard Smith7f0ffb32013-05-07 19:32:56 +000044// CHECK-1Y: has_decltype
45// CHECK-11: has_decltype
46// CHECK-NO-11: no_decltype
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000047
48
Douglas Gregor316551f2012-04-10 20:00:33 +000049#if __has_feature(cxx_decltype_incomplete_return_types)
50int has_decltype_incomplete_return_types();
51#else
52int no_decltype_incomplete_return_types();
53#endif
54
Richard Smith7f0ffb32013-05-07 19:32:56 +000055// CHECK-1Y: has_decltype_incomplete_return_types
56// CHECK-11: has_decltype_incomplete_return_types
57// CHECK-NO-11: no_decltype_incomplete_return_types
Douglas Gregor316551f2012-04-10 20:00:33 +000058
59
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000060#if __has_feature(cxx_auto_type)
Douglas Gregorc78e2592011-01-26 15:36:03 +000061int has_auto_type();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000062#else
63int no_auto_type();
64#endif
65
Richard Smith7f0ffb32013-05-07 19:32:56 +000066// CHECK-1Y: has_auto_type
67// CHECK-11: has_auto_type
68// CHECK-NO-11: no_auto_type
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000069
70
Richard Smith6a4e73c2011-04-03 14:12:46 +000071#if __has_feature(cxx_trailing_return)
72int has_trailing_return();
73#else
74int no_trailing_return();
75#endif
76
Richard Smith7f0ffb32013-05-07 19:32:56 +000077// CHECK-1Y: has_trailing_return
78// CHECK-11: has_trailing_return
79// CHECK-NO-11: no_trailing_return
Richard Smith6a4e73c2011-04-03 14:12:46 +000080
81
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000082#if __has_feature(cxx_attributes)
Douglas Gregorc78e2592011-01-26 15:36:03 +000083int has_attributes();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000084#else
85int no_attributes();
86#endif
87
Richard Smith7f0ffb32013-05-07 19:32:56 +000088// CHECK-1Y: has_attributes
89// CHECK-11: has_attributes
90// CHECK-NO-11: no_attributes
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000091
92
93#if __has_feature(cxx_static_assert)
Sean Hunt12484512010-01-13 08:58:42 +000094int has_static_assert();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000095#else
96int no_static_assert();
97#endif
98
Richard Smith7f0ffb32013-05-07 19:32:56 +000099// CHECK-1Y: has_static_assert
100// CHECK-11: has_static_assert
101// CHECK-NO-11: no_static_assert
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000102
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000103#if __has_feature(cxx_deleted_functions)
Douglas Gregorc78e2592011-01-26 15:36:03 +0000104int has_deleted_functions();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000105#else
106int no_deleted_functions();
107#endif
108
Richard Smith7f0ffb32013-05-07 19:32:56 +0000109// CHECK-1Y: has_deleted_functions
110// CHECK-11: has_deleted_functions
111// CHECK-NO-11: no_deleted_functions
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000112
Douglas Gregorf695a692011-11-01 01:19:34 +0000113#if __has_feature(cxx_defaulted_functions)
114int has_defaulted_functions();
115#else
116int no_defaulted_functions();
117#endif
118
Richard Smith7f0ffb32013-05-07 19:32:56 +0000119// CHECK-1Y: has_defaulted_functions
120// CHECK-11: has_defaulted_functions
121// CHECK-NO-11: no_defaulted_functions
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000122
123#if __has_feature(cxx_rvalue_references)
Douglas Gregorc78e2592011-01-26 15:36:03 +0000124int has_rvalue_references();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000125#else
126int no_rvalue_references();
127#endif
128
Richard Smith7f0ffb32013-05-07 19:32:56 +0000129// CHECK-1Y: has_rvalue_references
130// CHECK-11: has_rvalue_references
131// CHECK-NO-11: no_rvalue_references
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000132
133
134#if __has_feature(cxx_variadic_templates)
Douglas Gregorc78e2592011-01-26 15:36:03 +0000135int has_variadic_templates();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000136#else
137int no_variadic_templates();
138#endif
139
Richard Smith7f0ffb32013-05-07 19:32:56 +0000140// CHECK-1Y: has_variadic_templates
141// CHECK-11: has_variadic_templates
142// CHECK-NO-11: no_variadic_templates
Sebastian Redlf6c09772010-08-31 23:28:47 +0000143
144
145#if __has_feature(cxx_inline_namespaces)
Douglas Gregorc78e2592011-01-26 15:36:03 +0000146int has_inline_namespaces();
Sebastian Redlf6c09772010-08-31 23:28:47 +0000147#else
148int no_inline_namespaces();
149#endif
150
Richard Smith7f0ffb32013-05-07 19:32:56 +0000151// CHECK-1Y: has_inline_namespaces
152// CHECK-11: has_inline_namespaces
153// CHECK-NO-11: no_inline_namespaces
Douglas Gregor56209ff2011-01-26 21:25:54 +0000154
Richard Smitha391a462011-04-15 15:14:40 +0000155
156#if __has_feature(cxx_range_for)
157int has_range_for();
158#else
159int no_range_for();
160#endif
161
Richard Smith7f0ffb32013-05-07 19:32:56 +0000162// CHECK-1Y: has_range_for
163// CHECK-11: has_range_for
164// CHECK-NO-11: no_range_for
Richard Smitha391a462011-04-15 15:14:40 +0000165
166
Douglas Gregor56209ff2011-01-26 21:25:54 +0000167#if __has_feature(cxx_reference_qualified_functions)
168int has_reference_qualified_functions();
169#else
170int no_reference_qualified_functions();
171#endif
172
Richard Smith7f0ffb32013-05-07 19:32:56 +0000173// CHECK-1Y: has_reference_qualified_functions
174// CHECK-11: has_reference_qualified_functions
175// CHECK-NO-11: no_reference_qualified_functions
Douglas Gregor56209ff2011-01-26 21:25:54 +0000176
Douglas Gregor07508002011-02-05 20:35:30 +0000177#if __has_feature(cxx_default_function_template_args)
178int has_default_function_template_args();
179#else
180int no_default_function_template_args();
181#endif
182
Richard Smith7f0ffb32013-05-07 19:32:56 +0000183// CHECK-1Y: has_default_function_template_args
184// CHECK-11: has_default_function_template_args
185// CHECK-NO-11: no_default_function_template_args
Douglas Gregor07508002011-02-05 20:35:30 +0000186
Sebastian Redl4561ecd2011-03-15 21:17:12 +0000187#if __has_feature(cxx_noexcept)
188int has_noexcept();
189#else
190int no_noexcept();
191#endif
192
Richard Smith7f0ffb32013-05-07 19:32:56 +0000193// CHECK-1Y: has_noexcept
194// CHECK-11: has_noexcept
195// CHECK-NO-11: no_noexcept
Sebastian Redl4561ecd2011-03-15 21:17:12 +0000196
Anders Carlssonc8b9f792011-03-25 15:04:23 +0000197#if __has_feature(cxx_override_control)
198int has_override_control();
199#else
200int no_override_control();
201#endif
202
Richard Smith7f0ffb32013-05-07 19:32:56 +0000203// CHECK-1Y: has_override_control
204// CHECK-11: has_override_control
205// CHECK-NO-11: no_override_control
Richard Smith3e4c6c42011-05-05 21:57:07 +0000206
207#if __has_feature(cxx_alias_templates)
208int has_alias_templates();
209#else
210int no_alias_templates();
211#endif
212
Richard Smith7f0ffb32013-05-07 19:32:56 +0000213// CHECK-1Y: has_alias_templates
214// CHECK-11: has_alias_templates
215// CHECK-NO-11: no_alias_templates
Sebastian Redl74e611a2011-09-04 18:14:28 +0000216
217#if __has_feature(cxx_implicit_moves)
218int has_implicit_moves();
219#else
220int no_implicit_moves();
221#endif
222
Richard Smith7f0ffb32013-05-07 19:32:56 +0000223// CHECK-1Y: has_implicit_moves
224// CHECK-11: has_implicit_moves
225// CHECK-NO-11: no_implicit_moves
Peter Collingbournefd5f6862011-10-14 23:44:46 +0000226
227#if __has_feature(cxx_alignas)
228int has_alignas();
229#else
230int no_alignas();
231#endif
232
Richard Smith7f0ffb32013-05-07 19:32:56 +0000233// CHECK-1Y: has_alignas
234// CHECK-11: has_alignas
235// CHECK-NO-11: no_alignas
Douglas Gregor172b2212011-11-01 01:23:44 +0000236
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700237#if __has_feature(cxx_alignof)
238int has_alignof();
239#else
240int no_alignof();
241#endif
242
243// CHECK-1Y: has_alignof
244// CHECK-11: has_alignof
245// CHECK-NO-11: no_alignof
246
Douglas Gregor172b2212011-11-01 01:23:44 +0000247#if __has_feature(cxx_raw_string_literals)
248int has_raw_string_literals();
249#else
250int no_raw_string_literals();
251#endif
252
Richard Smith7f0ffb32013-05-07 19:32:56 +0000253// CHECK-1Y: has_raw_string_literals
254// CHECK-11: has_raw_string_literals
255// CHECK-NO-11: no_raw_string_literals
Douglas Gregor172b2212011-11-01 01:23:44 +0000256
257#if __has_feature(cxx_unicode_literals)
258int has_unicode_literals();
259#else
260int no_unicode_literals();
261#endif
262
Richard Smith7f0ffb32013-05-07 19:32:56 +0000263// CHECK-1Y: has_unicode_literals
264// CHECK-11: has_unicode_literals
265// CHECK-NO-11: no_unicode_literals
Richard Smithb5216aa2012-02-14 22:56:17 +0000266
267#if __has_feature(cxx_constexpr)
268int has_constexpr();
269#else
270int no_constexpr();
271#endif
272
Richard Smith7f0ffb32013-05-07 19:32:56 +0000273// CHECK-1Y: has_constexpr
274// CHECK-11: has_constexpr
275// CHECK-NO-11: no_constexpr
Sebastian Redld1dc3aa2012-02-25 20:51:27 +0000276
277#if __has_feature(cxx_generalized_initializers)
278int has_generalized_initializers();
279#else
280int no_generalized_initializers();
281#endif
282
Richard Smith7f0ffb32013-05-07 19:32:56 +0000283// CHECK-1Y: has_generalized_initializers
284// CHECK-11: has_generalized_initializers
285// CHECK-NO-11: no_generalized_initializers
Richard Smithec92bc72012-03-03 23:51:05 +0000286
287#if __has_feature(cxx_unrestricted_unions)
288int has_unrestricted_unions();
289#else
290int no_unrestricted_unions();
291#endif
292
Richard Smith7f0ffb32013-05-07 19:32:56 +0000293// CHECK-1Y: has_unrestricted_unions
294// CHECK-11: has_unrestricted_unions
295// CHECK-NO-11: no_unrestricted_unions
Richard Smith9c1dda72012-03-09 08:41:27 +0000296
297#if __has_feature(cxx_user_literals)
298int has_user_literals();
299#else
300int no_user_literals();
301#endif
302
Richard Smith7f0ffb32013-05-07 19:32:56 +0000303// CHECK-1Y: has_user_literals
304// CHECK-11: has_user_literals
305// CHECK-NO-11: no_user_literals
Douglas Gregor7b156dd2012-04-04 00:48:39 +0000306
307#if __has_feature(cxx_local_type_template_args)
308int has_local_type_template_args();
309#else
310int no_local_type_template_args();
311#endif
312
Richard Smith7f0ffb32013-05-07 19:32:56 +0000313// CHECK-1Y: has_local_type_template_args
314// CHECK-11: has_local_type_template_args
315// CHECK-NO-11: no_local_type_template_args
Richard Smithe6e68b52013-04-19 17:00:31 +0000316
317#if __has_feature(cxx_inheriting_constructors)
318int has_inheriting_constructors();
319#else
320int no_inheriting_constructors();
321#endif
322
Richard Smith7f0ffb32013-05-07 19:32:56 +0000323// CHECK-1Y: has_inheriting_constructors
324// CHECK-11: has_inheriting_constructors
325// CHECK-NO-11: no_inheriting_constructors
Richard Smithe6e68b52013-04-19 17:00:31 +0000326
327#if __has_feature(cxx_thread_local)
328int has_thread_local();
329#else
330int no_thread_local();
331#endif
332
Richard Smith7f0ffb32013-05-07 19:32:56 +0000333// CHECK-1Y: has_thread_local
334// CHECK-11: has_thread_local
335// CHECK-NO-11: no_thread_local
Douglas Gregore87c5bd2013-05-02 05:28:32 +0000336// CHECK-NO-TLS: no_thread_local
Richard Smith7f0ffb32013-05-07 19:32:56 +0000337
338// === C++1y features ===
339
340#if __has_feature(cxx_binary_literals)
341int has_binary_literals();
342#else
343int no_binary_literals();
344#endif
345
346// CHECK-1Y: has_binary_literals
347// CHECK-11: no_binary_literals
348// CHECK-NO-11: no_binary_literals
349
350#if __has_feature(cxx_aggregate_nsdmi)
351int has_aggregate_nsdmi();
352#else
353int no_aggregate_nsdmi();
354#endif
355
356// CHECK-1Y: has_aggregate_nsdmi
357// CHECK-11: no_aggregate_nsdmi
358// CHECK-NO-11: no_aggregate_nsdmi
Richard Smithf45c2992013-05-12 03:09:35 +0000359
360#if __has_feature(cxx_return_type_deduction)
361int has_return_type_deduction();
362#else
363int no_return_type_deduction();
364#endif
365
366// CHECK-1Y: has_return_type_deduction
367// CHECK-11: no_return_type_deduction
368// CHECK-NO-11: no_return_type_deduction
Richard Smitha4fb3392013-07-24 17:41:31 +0000369
370#if __has_feature(cxx_contextual_conversions)
371int has_contextual_conversions();
372#else
373int no_contextual_conversions();
374#endif
375
376// CHECK-1Y: has_contextual_conversions
377// CHECK-11: no_contextual_conversions
378// CHECK-NO-11: no_contextual_conversions
379
380#if __has_feature(cxx_relaxed_constexpr)
381int has_relaxed_constexpr();
382#else
383int no_relaxed_constexpr();
384#endif
385
386// CHECK-1Y: has_relaxed_constexpr
387// CHECK-11: no_relaxed_constexpr
388// CHECK-NO-11: no_relaxed_constexpr
Richard Smith629bc522013-09-27 20:19:41 +0000389
390#if __has_feature(cxx_variable_templates)
391int has_variable_templates();
392#else
393int no_variable_templates();
394#endif
395
396// CHECK-1Y: has_variable_templates
397// CHECK-11: no_variable_templates
398// CHECK-NO-11: no_variable_templates
Richard Smith44868f52013-09-28 04:37:56 +0000399
400#if __has_feature(cxx_init_captures)
401int has_init_captures();
402#else
403int no_init_captures();
404#endif
405
406// CHECK-1Y: has_init_captures
407// CHECK-11: no_init_captures
408// CHECK-NO-11: no_init_captures
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700409
410#if __has_feature(cxx_decltype_auto)
411int has_decltype_auto();
412#else
413int no_decltype_auto();
414#endif
415
416// CHECK-1Y: has_decltype_auto
417// CHECK-11: no_decltype_auto
418// CHECK-NO-11: no_decltype_auto
419
420#if __has_feature(cxx_generic_lambdas)
421int has_generic_lambdas();
422#else
423int no_generic_lambdas();
424#endif
425
426// CHECK-1Y: has_generic_lambdas
427// CHECK-11: no_generic_lambdas
428// CHECK-NO-11: no_generic_lambdas