blob: 8e0222dcecd59b58395ddb0dedc7ffd49644b141 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -E -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s
Daniel Dunbar9fde9c42010-06-29 16:52:24 +00002// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
Sean Hunt4ef4c6b2010-01-13 08:31:49 +00003
David Chisnall7a7ee302012-01-16 17:27:18 +00004#if __has_feature(cxx_atomic)
5int has_atomic();
6#else
7int no_atomic();
8#endif
9
10// CHECK-0X: has_atomic
11// CHECK-NO-0X: no_atomic
12
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000013#if __has_feature(cxx_lambdas)
Douglas Gregorc78e2592011-01-26 15:36:03 +000014int has_lambdas();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000015#else
16int no_lambdas();
17#endif
18
Douglas Gregor7c07e962012-02-23 03:02:32 +000019// CHECK-0X: has_lambdas
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000020// CHECK-NO-0X: no_lambdas
21
22
23#if __has_feature(cxx_nullptr)
Sean Hunt12484512010-01-13 08:58:42 +000024int has_nullptr();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000025#else
26int no_nullptr();
27#endif
28
Douglas Gregor84ee2ee2011-05-21 23:15:46 +000029// CHECK-0X: has_nullptr
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000030// CHECK-NO-0X: no_nullptr
31
32
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000033#if __has_feature(cxx_decltype)
Sean Hunt12484512010-01-13 08:58:42 +000034int has_decltype();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000035#else
36int no_decltype();
37#endif
38
Sean Hunt12484512010-01-13 08:58:42 +000039// CHECK-0X: has_decltype
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000040// CHECK-NO-0X: no_decltype
41
42
Douglas Gregor316551f2012-04-10 20:00:33 +000043#if __has_feature(cxx_decltype_incomplete_return_types)
44int has_decltype_incomplete_return_types();
45#else
46int no_decltype_incomplete_return_types();
47#endif
48
49// CHECK-0X: has_decltype_incomplete_return_types
50// CHECK-NO-0X: no_decltype_incomplete_return_types
51
52
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000053#if __has_feature(cxx_auto_type)
Douglas Gregorc78e2592011-01-26 15:36:03 +000054int has_auto_type();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000055#else
56int no_auto_type();
57#endif
58
Richard Smith738291e2011-02-20 12:13:05 +000059// CHECK-0X: has_auto_type
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000060// CHECK-NO-0X: no_auto_type
61
62
Richard Smith6a4e73c2011-04-03 14:12:46 +000063#if __has_feature(cxx_trailing_return)
64int has_trailing_return();
65#else
66int no_trailing_return();
67#endif
68
69// CHECK-0X: has_trailing_return
70// CHECK-NO-0X: no_trailing_return
71
72
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000073#if __has_feature(cxx_attributes)
Douglas Gregorc78e2592011-01-26 15:36:03 +000074int has_attributes();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000075#else
76int no_attributes();
77#endif
78
Douglas Gregorc78e2592011-01-26 15:36:03 +000079// CHECK-0X: has_attributes
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000080// CHECK-NO-0X: no_attributes
81
82
83#if __has_feature(cxx_static_assert)
Sean Hunt12484512010-01-13 08:58:42 +000084int has_static_assert();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000085#else
86int no_static_assert();
87#endif
88
Sean Hunt12484512010-01-13 08:58:42 +000089// CHECK-0X: has_static_assert
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000090// CHECK-NO-0X: no_static_assert
91
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000092#if __has_feature(cxx_deleted_functions)
Douglas Gregorc78e2592011-01-26 15:36:03 +000093int has_deleted_functions();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +000094#else
95int no_deleted_functions();
96#endif
97
Douglas Gregorc78e2592011-01-26 15:36:03 +000098// CHECK-0X: has_deleted_functions
99// CHECK-NO-0X: no_deleted_functions
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000100
Douglas Gregorf695a692011-11-01 01:19:34 +0000101#if __has_feature(cxx_defaulted_functions)
102int has_defaulted_functions();
103#else
104int no_defaulted_functions();
105#endif
106
107// CHECK-0X: has_defaulted_functions
108// CHECK-NO-0X: no_defaulted_functions
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000109
110#if __has_feature(cxx_rvalue_references)
Douglas Gregorc78e2592011-01-26 15:36:03 +0000111int has_rvalue_references();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000112#else
113int no_rvalue_references();
114#endif
115
Douglas Gregorc78e2592011-01-26 15:36:03 +0000116// CHECK-0X: has_rvalue_references
117// CHECK-NO-0X: no_rvalue_references
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000118
119
120#if __has_feature(cxx_variadic_templates)
Douglas Gregorc78e2592011-01-26 15:36:03 +0000121int has_variadic_templates();
Sean Hunt4ef4c6b2010-01-13 08:31:49 +0000122#else
123int no_variadic_templates();
124#endif
125
Douglas Gregorc78e2592011-01-26 15:36:03 +0000126// CHECK-0X: has_variadic_templates
127// CHECK-NO-0X: no_variadic_templates
Sebastian Redlf6c09772010-08-31 23:28:47 +0000128
129
130#if __has_feature(cxx_inline_namespaces)
Douglas Gregorc78e2592011-01-26 15:36:03 +0000131int has_inline_namespaces();
Sebastian Redlf6c09772010-08-31 23:28:47 +0000132#else
133int no_inline_namespaces();
134#endif
135
Douglas Gregorc78e2592011-01-26 15:36:03 +0000136// CHECK-0X: has_inline_namespaces
137// CHECK-NO-0X: no_inline_namespaces
Douglas Gregor56209ff2011-01-26 21:25:54 +0000138
Richard Smitha391a462011-04-15 15:14:40 +0000139
140#if __has_feature(cxx_range_for)
141int has_range_for();
142#else
143int no_range_for();
144#endif
145
146// CHECK-0X: has_range_for
147// CHECK-NO-0X: no_range_for
148
149
Douglas Gregor56209ff2011-01-26 21:25:54 +0000150#if __has_feature(cxx_reference_qualified_functions)
151int has_reference_qualified_functions();
152#else
153int no_reference_qualified_functions();
154#endif
155
156// CHECK-0X: has_reference_qualified_functions
157// CHECK-NO-0X: no_reference_qualified_functions
158
Douglas Gregor07508002011-02-05 20:35:30 +0000159#if __has_feature(cxx_default_function_template_args)
160int has_default_function_template_args();
161#else
162int no_default_function_template_args();
163#endif
164
165// CHECK-0X: has_default_function_template_args
166// CHECK-NO-0X: no_default_function_template_args
167
Sebastian Redl4561ecd2011-03-15 21:17:12 +0000168#if __has_feature(cxx_noexcept)
169int has_noexcept();
170#else
171int no_noexcept();
172#endif
173
174// CHECK-0X: has_noexcept
175// CHECK-NO-0X: no_noexcept
176
Anders Carlssonc8b9f792011-03-25 15:04:23 +0000177#if __has_feature(cxx_override_control)
178int has_override_control();
179#else
180int no_override_control();
181#endif
182
183// CHECK-0X: has_override_control
184// CHECK-NO-0X: no_override_control
Richard Smith3e4c6c42011-05-05 21:57:07 +0000185
186#if __has_feature(cxx_alias_templates)
187int has_alias_templates();
188#else
189int no_alias_templates();
190#endif
191
192// CHECK-0X: has_alias_templates
193// CHECK-NO-0X: no_alias_templates
Sebastian Redl74e611a2011-09-04 18:14:28 +0000194
195#if __has_feature(cxx_implicit_moves)
196int has_implicit_moves();
197#else
198int no_implicit_moves();
199#endif
200
201// CHECK-0X: has_implicit_moves
202// CHECK-NO-0X: no_implicit_moves
Peter Collingbournefd5f6862011-10-14 23:44:46 +0000203
204#if __has_feature(cxx_alignas)
205int has_alignas();
206#else
207int no_alignas();
208#endif
209
210// CHECK-0X: has_alignas
211// CHECK-NO-0X: no_alignas
Douglas Gregor172b2212011-11-01 01:23:44 +0000212
213#if __has_feature(cxx_raw_string_literals)
214int has_raw_string_literals();
215#else
216int no_raw_string_literals();
217#endif
218
219// CHECK-0X: has_raw_string_literals
220// CHECK-NO-0X: no_raw_string_literals
221
222#if __has_feature(cxx_unicode_literals)
223int has_unicode_literals();
224#else
225int no_unicode_literals();
226#endif
227
228// CHECK-0X: has_unicode_literals
229// CHECK-NO-0X: no_unicode_literals
Richard Smithb5216aa2012-02-14 22:56:17 +0000230
231#if __has_feature(cxx_constexpr)
232int has_constexpr();
233#else
234int no_constexpr();
235#endif
236
237// CHECK-0X: has_constexpr
238// CHECK-NO-0X: no_constexpr
Sebastian Redld1dc3aa2012-02-25 20:51:27 +0000239
240#if __has_feature(cxx_generalized_initializers)
241int has_generalized_initializers();
242#else
243int no_generalized_initializers();
244#endif
245
246// CHECK-0X: has_generalized_initializers
247// CHECK-NO-0X: no_generalized_initializers
Richard Smithec92bc72012-03-03 23:51:05 +0000248
249#if __has_feature(cxx_unrestricted_unions)
250int has_unrestricted_unions();
251#else
252int no_unrestricted_unions();
253#endif
254
255// CHECK-0X: has_unrestricted_unions
256// CHECK-NO-0X: no_unrestricted_unions
Richard Smith9c1dda72012-03-09 08:41:27 +0000257
258#if __has_feature(cxx_user_literals)
259int has_user_literals();
260#else
261int no_user_literals();
262#endif
263
264// CHECK-0X: has_user_literals
265// CHECK-NO-0X: no_user_literals
Douglas Gregor7b156dd2012-04-04 00:48:39 +0000266
267#if __has_feature(cxx_local_type_template_args)
268int has_local_type_template_args();
269#else
270int no_local_type_template_args();
271#endif
272
273// CHECK-0X: has_local_type_template_args
274// CHECK-NO-0X: no_local_type_template_args