blob: 2dc2abe87cf255628d5aa590697576951374eb6d [file] [log] [blame]
Richard Smith0a715422013-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 Gregora7130bf2013-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 Smith0a715422013-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
Alexis Huntaf4e28d2010-01-13 08:31:49 +00005
David Chisnallfa35df62012-01-16 17:27:18 +00006#if __has_feature(cxx_atomic)
7int has_atomic();
8#else
9int no_atomic();
10#endif
11
Richard Smith0a715422013-05-07 19:32:56 +000012// CHECK-1Y: has_atomic
13// CHECK-11: has_atomic
14// CHECK-NO-11: no_atomic
David Chisnallfa35df62012-01-16 17:27:18 +000015
Alexis Huntaf4e28d2010-01-13 08:31:49 +000016#if __has_feature(cxx_lambdas)
Douglas Gregorc41d94e2011-01-26 15:36:03 +000017int has_lambdas();
Alexis Huntaf4e28d2010-01-13 08:31:49 +000018#else
19int no_lambdas();
20#endif
21
Richard Smith0a715422013-05-07 19:32:56 +000022// CHECK-1Y: has_lambdas
23// CHECK-11: has_lambdas
24// CHECK-NO-11: no_lambdas
Alexis Huntaf4e28d2010-01-13 08:31:49 +000025
26
27#if __has_feature(cxx_nullptr)
Alexis Hunt10e2f722010-01-13 08:58:42 +000028int has_nullptr();
Alexis Huntaf4e28d2010-01-13 08:31:49 +000029#else
30int no_nullptr();
31#endif
32
Richard Smith0a715422013-05-07 19:32:56 +000033// CHECK-1Y: has_nullptr
34// CHECK-11: has_nullptr
35// CHECK-NO-11: no_nullptr
Alexis Huntaf4e28d2010-01-13 08:31:49 +000036
37
Alexis Huntaf4e28d2010-01-13 08:31:49 +000038#if __has_feature(cxx_decltype)
Alexis Hunt10e2f722010-01-13 08:58:42 +000039int has_decltype();
Alexis Huntaf4e28d2010-01-13 08:31:49 +000040#else
41int no_decltype();
42#endif
43
Richard Smith0a715422013-05-07 19:32:56 +000044// CHECK-1Y: has_decltype
45// CHECK-11: has_decltype
46// CHECK-NO-11: no_decltype
Alexis Huntaf4e28d2010-01-13 08:31:49 +000047
48
Douglas Gregor05989622012-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 Smith0a715422013-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 Gregor05989622012-04-10 20:00:33 +000058
59
Alexis Huntaf4e28d2010-01-13 08:31:49 +000060#if __has_feature(cxx_auto_type)
Douglas Gregorc41d94e2011-01-26 15:36:03 +000061int has_auto_type();
Alexis Huntaf4e28d2010-01-13 08:31:49 +000062#else
63int no_auto_type();
64#endif
65
Richard Smith0a715422013-05-07 19:32:56 +000066// CHECK-1Y: has_auto_type
67// CHECK-11: has_auto_type
68// CHECK-NO-11: no_auto_type
Alexis Huntaf4e28d2010-01-13 08:31:49 +000069
70
Richard Smith13f68cf2011-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 Smith0a715422013-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 Smith13f68cf2011-04-03 14:12:46 +000080
81
Alexis Huntaf4e28d2010-01-13 08:31:49 +000082#if __has_feature(cxx_attributes)
Douglas Gregorc41d94e2011-01-26 15:36:03 +000083int has_attributes();
Alexis Huntaf4e28d2010-01-13 08:31:49 +000084#else
85int no_attributes();
86#endif
87
Richard Smith0a715422013-05-07 19:32:56 +000088// CHECK-1Y: has_attributes
89// CHECK-11: has_attributes
90// CHECK-NO-11: no_attributes
Alexis Huntaf4e28d2010-01-13 08:31:49 +000091
92
93#if __has_feature(cxx_static_assert)
Alexis Hunt10e2f722010-01-13 08:58:42 +000094int has_static_assert();
Alexis Huntaf4e28d2010-01-13 08:31:49 +000095#else
96int no_static_assert();
97#endif
98
Richard Smith0a715422013-05-07 19:32:56 +000099// CHECK-1Y: has_static_assert
100// CHECK-11: has_static_assert
101// CHECK-NO-11: no_static_assert
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000102
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000103#if __has_feature(cxx_deleted_functions)
Douglas Gregorc41d94e2011-01-26 15:36:03 +0000104int has_deleted_functions();
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000105#else
106int no_deleted_functions();
107#endif
108
Richard Smith0a715422013-05-07 19:32:56 +0000109// CHECK-1Y: has_deleted_functions
110// CHECK-11: has_deleted_functions
111// CHECK-NO-11: no_deleted_functions
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000112
Douglas Gregor3c469762011-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 Smith0a715422013-05-07 19:32:56 +0000119// CHECK-1Y: has_defaulted_functions
120// CHECK-11: has_defaulted_functions
121// CHECK-NO-11: no_defaulted_functions
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000122
123#if __has_feature(cxx_rvalue_references)
Douglas Gregorc41d94e2011-01-26 15:36:03 +0000124int has_rvalue_references();
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000125#else
126int no_rvalue_references();
127#endif
128
Richard Smith0a715422013-05-07 19:32:56 +0000129// CHECK-1Y: has_rvalue_references
130// CHECK-11: has_rvalue_references
131// CHECK-NO-11: no_rvalue_references
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000132
133
134#if __has_feature(cxx_variadic_templates)
Douglas Gregorc41d94e2011-01-26 15:36:03 +0000135int has_variadic_templates();
Alexis Huntaf4e28d2010-01-13 08:31:49 +0000136#else
137int no_variadic_templates();
138#endif
139
Richard Smith0a715422013-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 Redla93bb5b2010-08-31 23:28:47 +0000143
144
145#if __has_feature(cxx_inline_namespaces)
Douglas Gregorc41d94e2011-01-26 15:36:03 +0000146int has_inline_namespaces();
Sebastian Redla93bb5b2010-08-31 23:28:47 +0000147#else
148int no_inline_namespaces();
149#endif
150
Richard Smith0a715422013-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 Gregor56d5f0a2011-01-26 21:25:54 +0000154
Richard Smith9bc6eed2011-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 Smith0a715422013-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 Smith9bc6eed2011-04-15 15:14:40 +0000165
166
Douglas Gregor56d5f0a2011-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 Smith0a715422013-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 Gregor56d5f0a2011-01-26 21:25:54 +0000176
Douglas Gregor7115aee2011-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 Smith0a715422013-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 Gregor7115aee2011-02-05 20:35:30 +0000186
Sebastian Redlc17003c2011-03-15 21:17:12 +0000187#if __has_feature(cxx_noexcept)
188int has_noexcept();
189#else
190int no_noexcept();
191#endif
192
Richard Smith0a715422013-05-07 19:32:56 +0000193// CHECK-1Y: has_noexcept
194// CHECK-11: has_noexcept
195// CHECK-NO-11: no_noexcept
Sebastian Redlc17003c2011-03-15 21:17:12 +0000196
Anders Carlsson69f1f932011-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 Smith0a715422013-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 Smith3f1b5d02011-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 Smith0a715422013-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 Redle9c4e842011-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 Smith0a715422013-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 Collingbourne60188eb2011-10-14 23:44:46 +0000226
227#if __has_feature(cxx_alignas)
228int has_alignas();
229#else
230int no_alignas();
231#endif
232
Richard Smith0a715422013-05-07 19:32:56 +0000233// CHECK-1Y: has_alignas
234// CHECK-11: has_alignas
235// CHECK-NO-11: no_alignas
Douglas Gregora7efb882011-11-01 01:23:44 +0000236
237#if __has_feature(cxx_raw_string_literals)
238int has_raw_string_literals();
239#else
240int no_raw_string_literals();
241#endif
242
Richard Smith0a715422013-05-07 19:32:56 +0000243// CHECK-1Y: has_raw_string_literals
244// CHECK-11: has_raw_string_literals
245// CHECK-NO-11: no_raw_string_literals
Douglas Gregora7efb882011-11-01 01:23:44 +0000246
247#if __has_feature(cxx_unicode_literals)
248int has_unicode_literals();
249#else
250int no_unicode_literals();
251#endif
252
Richard Smith0a715422013-05-07 19:32:56 +0000253// CHECK-1Y: has_unicode_literals
254// CHECK-11: has_unicode_literals
255// CHECK-NO-11: no_unicode_literals
Richard Smith1cb2af02012-02-14 22:56:17 +0000256
257#if __has_feature(cxx_constexpr)
258int has_constexpr();
259#else
260int no_constexpr();
261#endif
262
Richard Smith0a715422013-05-07 19:32:56 +0000263// CHECK-1Y: has_constexpr
264// CHECK-11: has_constexpr
265// CHECK-NO-11: no_constexpr
Sebastian Redld89c2182012-02-25 20:51:27 +0000266
267#if __has_feature(cxx_generalized_initializers)
268int has_generalized_initializers();
269#else
270int no_generalized_initializers();
271#endif
272
Richard Smith0a715422013-05-07 19:32:56 +0000273// CHECK-1Y: has_generalized_initializers
274// CHECK-11: has_generalized_initializers
275// CHECK-NO-11: no_generalized_initializers
Richard Smith522fa532012-03-03 23:51:05 +0000276
277#if __has_feature(cxx_unrestricted_unions)
278int has_unrestricted_unions();
279#else
280int no_unrestricted_unions();
281#endif
282
Richard Smith0a715422013-05-07 19:32:56 +0000283// CHECK-1Y: has_unrestricted_unions
284// CHECK-11: has_unrestricted_unions
285// CHECK-NO-11: no_unrestricted_unions
Richard Smith50231882012-03-09 08:41:27 +0000286
287#if __has_feature(cxx_user_literals)
288int has_user_literals();
289#else
290int no_user_literals();
291#endif
292
Richard Smith0a715422013-05-07 19:32:56 +0000293// CHECK-1Y: has_user_literals
294// CHECK-11: has_user_literals
295// CHECK-NO-11: no_user_literals
Douglas Gregor97818932012-04-04 00:48:39 +0000296
297#if __has_feature(cxx_local_type_template_args)
298int has_local_type_template_args();
299#else
300int no_local_type_template_args();
301#endif
302
Richard Smith0a715422013-05-07 19:32:56 +0000303// CHECK-1Y: has_local_type_template_args
304// CHECK-11: has_local_type_template_args
305// CHECK-NO-11: no_local_type_template_args
Richard Smith25b555a2013-04-19 17:00:31 +0000306
307#if __has_feature(cxx_inheriting_constructors)
308int has_inheriting_constructors();
309#else
310int no_inheriting_constructors();
311#endif
312
Richard Smith0a715422013-05-07 19:32:56 +0000313// CHECK-1Y: has_inheriting_constructors
314// CHECK-11: has_inheriting_constructors
315// CHECK-NO-11: no_inheriting_constructors
Richard Smith25b555a2013-04-19 17:00:31 +0000316
317#if __has_feature(cxx_thread_local)
318int has_thread_local();
319#else
320int no_thread_local();
321#endif
322
Richard Smith0a715422013-05-07 19:32:56 +0000323// CHECK-1Y: has_thread_local
324// CHECK-11: has_thread_local
325// CHECK-NO-11: no_thread_local
Douglas Gregora7130bf2013-05-02 05:28:32 +0000326// CHECK-NO-TLS: no_thread_local
Richard Smith0a715422013-05-07 19:32:56 +0000327
328// === C++1y features ===
329
330#if __has_feature(cxx_binary_literals)
331int has_binary_literals();
332#else
333int no_binary_literals();
334#endif
335
336// CHECK-1Y: has_binary_literals
337// CHECK-11: no_binary_literals
338// CHECK-NO-11: no_binary_literals
339
340#if __has_feature(cxx_aggregate_nsdmi)
341int has_aggregate_nsdmi();
342#else
343int no_aggregate_nsdmi();
344#endif
345
346// CHECK-1Y: has_aggregate_nsdmi
347// CHECK-11: no_aggregate_nsdmi
348// CHECK-NO-11: no_aggregate_nsdmi
Richard Smith9155be12013-05-12 03:09:35 +0000349
350#if __has_feature(cxx_return_type_deduction)
351int has_return_type_deduction();
352#else
353int no_return_type_deduction();
354#endif
355
356// CHECK-1Y: has_return_type_deduction
357// CHECK-11: no_return_type_deduction
358// CHECK-NO-11: no_return_type_deduction
Richard Smithc0f7b812013-07-24 17:41:31 +0000359
360#if __has_feature(cxx_contextual_conversions)
361int has_contextual_conversions();
362#else
363int no_contextual_conversions();
364#endif
365
366// CHECK-1Y: has_contextual_conversions
367// CHECK-11: no_contextual_conversions
368// CHECK-NO-11: no_contextual_conversions
369
370#if __has_feature(cxx_relaxed_constexpr)
371int has_relaxed_constexpr();
372#else
373int no_relaxed_constexpr();
374#endif
375
376// CHECK-1Y: has_relaxed_constexpr
377// CHECK-11: no_relaxed_constexpr
378// CHECK-NO-11: no_relaxed_constexpr