111
|
1 // { dg-options "-std=c++14 -I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" }
|
|
2
|
|
3 // C++98 features:
|
|
4
|
|
5 #ifndef __cpp_rtti
|
|
6 # error "__cpp_rtti"
|
|
7 #elif __cpp_rtti != 199711
|
|
8 # error "__cpp_rtti != 199711"
|
|
9 #endif
|
|
10
|
|
11 #ifndef __cpp_exceptions
|
|
12 # error "__cpp_exceptions"
|
|
13 #elif __cpp_exceptions != 199711
|
|
14 # error "__cpp_exceptions != 199711"
|
|
15 #endif
|
|
16
|
|
17 // C++11 features:
|
|
18
|
|
19 #ifndef __cpp_unicode_characters
|
|
20 # error "__cpp_unicode_characters"
|
|
21 #elif __cpp_unicode_characters != 200704
|
|
22 # error "__cpp_unicode_characters != 200704"
|
|
23 #endif
|
|
24
|
|
25 #ifndef __cpp_raw_strings
|
|
26 # error "__cpp_raw_strings"
|
|
27 #elif __cpp_raw_strings != 200710
|
|
28 # error "__cpp_raw_strings != 200710"
|
|
29 #endif
|
|
30
|
|
31 #ifndef __cpp_unicode_literals
|
|
32 # error "__cpp_unicode_literals"
|
|
33 #elif __cpp_unicode_literals != 200710
|
|
34 # error "__cpp_unicode_literals != 200710"
|
|
35 #endif
|
|
36
|
|
37 #ifndef __cpp_user_defined_literals
|
|
38 # error "__cpp_user_defined_literals"
|
|
39 #elif __cpp_user_defined_literals != 200809
|
|
40 # error "__cpp_user_defined_literals != 200809"
|
|
41 #endif
|
|
42
|
|
43 #ifndef __cpp_lambdas
|
|
44 # error "__cpp_lambdas"
|
|
45 #elif __cpp_lambdas != 200907
|
|
46 # error "__cpp_lambdas != 200907"
|
|
47 #endif
|
|
48
|
|
49 #ifndef __cpp_range_based_for
|
|
50 # error "__cpp_range_based_for"
|
|
51 #elif __cpp_range_based_for < 200907
|
|
52 # error "__cpp_range_based_for < 200907"
|
|
53 #endif
|
|
54
|
|
55 #ifndef __cpp_static_assert
|
|
56 # error "__cpp_static_assert"
|
|
57 #elif __cpp_static_assert != 200410
|
|
58 # error "__cpp_static_assert != 200410"
|
|
59 #endif
|
|
60
|
|
61 #ifndef __cpp_decltype
|
|
62 # error "__cpp_decltype"
|
|
63 #elif __cpp_decltype != 200707
|
|
64 # error "__cpp_decltype != 200707"
|
|
65 #endif
|
|
66
|
|
67 #ifndef __cpp_attributes
|
|
68 # error "__cpp_attributes"
|
|
69 #elif __cpp_attributes != 200809
|
|
70 # error "__cpp_attributes != 200809"
|
|
71 #endif
|
|
72
|
|
73 #ifndef __cpp_rvalue_references
|
|
74 # error "__cpp_rvalue_references"
|
|
75 #elif __cpp_rvalue_references != 200610
|
|
76 # error "__cpp_rvalue_references != 200610"
|
|
77 #endif
|
|
78
|
|
79 #ifndef __cpp_variadic_templates
|
|
80 # error "__cpp_variadic_templates"
|
|
81 #elif __cpp_variadic_templates != 200704
|
|
82 # error "__cpp_variadic_templates != 200704"
|
|
83 #endif
|
|
84
|
|
85 #ifndef __cpp_initializer_lists
|
|
86 # error "__cpp_initializer_lists"
|
|
87 #elif __cpp_initializer_lists != 200806
|
|
88 # error "__cpp_initializer_lists != 200806"
|
|
89 #endif
|
|
90
|
|
91 #ifndef __cpp_delegating_constructors
|
|
92 # error "__cpp_delegating_constructors"
|
|
93 #elif __cpp_delegating_constructors != 200604
|
|
94 # error "__cpp_delegating_constructors != 200604"
|
|
95 #endif
|
|
96
|
|
97 #ifndef __cpp_nsdmi
|
|
98 # error "__cpp_nsdmi"
|
|
99 #elif __cpp_nsdmi != 200809
|
|
100 # error "__cpp_nsdmi != 200809"
|
|
101 #endif
|
|
102
|
|
103 #ifndef __cpp_inheriting_constructors
|
|
104 # error "__cpp_inheriting_constructors"
|
|
105 #elif __cpp_inheriting_constructors!= 201511
|
|
106 # error "__cpp_inheriting_constructors != 201511"
|
|
107 #endif
|
|
108
|
|
109 #ifndef __cpp_ref_qualifiers
|
|
110 # error "__cpp_ref_qualifiers"
|
|
111 #elif __cpp_ref_qualifiers != 200710
|
|
112 # error "__cpp_ref_qualifiers != 200710"
|
|
113 #endif
|
|
114
|
|
115 #ifndef __cpp_alias_templates
|
|
116 # error "__cpp_alias_templates"
|
|
117 #elif __cpp_alias_templates != 200704
|
|
118 # error "__cpp_alias_templates != 200704"
|
|
119 #endif
|
|
120
|
|
121 #ifndef __cpp_threadsafe_static_init
|
|
122 # error "__cpp_threadsafe_static_init"
|
|
123 #elif __cpp_threadsafe_static_init != 200806
|
|
124 # error "__cpp_threadsafe_static_init != 200806"
|
|
125 #endif
|
|
126
|
|
127 // C++14 features:
|
|
128
|
|
129 #ifndef __cpp_binary_literals
|
|
130 # error "__cpp_binary_literals"
|
|
131 #elif __cpp_binary_literals != 201304
|
|
132 # error "__cpp_binary_literals != 201304"
|
|
133 #endif
|
|
134
|
|
135 #ifndef __cpp_init_captures
|
|
136 # error "__cpp_init_captures"
|
|
137 #elif __cpp_init_captures != 201304
|
|
138 # error "__cpp_init_captures != 201304"
|
|
139 #endif
|
|
140
|
|
141 #ifndef __cpp_generic_lambdas
|
|
142 # error "__cpp_generic_lambdas"
|
|
143 #elif __cpp_generic_lambdas != 201304
|
|
144 # error "__cpp_generic_lambdas != 201304"
|
|
145 #endif
|
|
146
|
|
147 #ifndef __cpp_constexpr
|
|
148 # error "__cpp_constexpr"
|
|
149 #elif __cpp_constexpr != 201304
|
|
150 # error "__cpp_constexpr != 201304"
|
|
151 #endif
|
|
152
|
|
153 #ifndef __cpp_decltype_auto
|
|
154 # error "__cpp_decltype_auto"
|
|
155 #elif __cpp_decltype_auto != 201304
|
|
156 # error "__cpp_decltype_auto != 201304"
|
|
157 #endif
|
|
158
|
|
159 #ifndef __cpp_return_type_deduction
|
|
160 # error "__cpp_return_type_deduction"
|
|
161 #elif __cpp_return_type_deduction != 201304
|
|
162 # error "__cpp_return_type_deduction != 201304"
|
|
163 #endif
|
|
164
|
|
165 #ifndef __cpp_aggregate_nsdmi
|
|
166 # error "__cpp_aggregate_nsdmi"
|
|
167 #elif __cpp_aggregate_nsdmi != 201304
|
|
168 # error "__cpp_aggregate_nsdmi != 201304"
|
|
169 #endif
|
|
170
|
|
171 #ifndef __cpp_variable_templates
|
|
172 # error "__cpp_variable_templates"
|
|
173 #elif __cpp_variable_templates != 201304
|
|
174 # error "__cpp_variable_templates != 201304"
|
|
175 #endif
|
|
176
|
|
177 #ifndef __cpp_digit_separators
|
|
178 # error "__cpp_digit_separators"
|
|
179 #elif __cpp_digit_separators != 201309
|
|
180 # error "__cpp_digit_separators != 201309"
|
|
181 #endif
|
|
182
|
|
183 #ifndef __cpp_sized_deallocation
|
|
184 # error "__cpp_sized_deallocation"
|
|
185 #elif __cpp_sized_deallocation != 201309
|
|
186 # error "__cpp_sized_deallocation != 201309"
|
|
187 #endif
|
|
188
|
|
189 // GNU VLA support:
|
|
190
|
|
191 #ifndef __cpp_runtime_arrays
|
|
192 # error "__cpp_runtime_arrays"
|
|
193 #elif __cpp_runtime_arrays != 198712
|
|
194 # error "__cpp_runtime_arrays != 198712"
|
|
195 #endif
|
|
196
|
|
197 // C++11 attributes:
|
|
198
|
|
199 #ifdef __has_cpp_attribute
|
|
200 # if ! __has_cpp_attribute(noreturn)
|
|
201 # error "__has_cpp_attribute(noreturn)"
|
|
202 # elif __has_cpp_attribute(noreturn) != 200809
|
|
203 # error "__has_cpp_attribute(noreturn) != 200809"
|
|
204 # endif
|
|
205 #else
|
|
206 # error "__has_cpp_attribute"
|
|
207 #endif
|
|
208
|
|
209 // Attribute carries_dependency not in yet.
|
|
210 //#ifdef __has_cpp_attribute
|
|
211 //# if ! __has_cpp_attribute(carries_dependency)
|
|
212 //# error "__has_cpp_attribute(carries_dependency)"
|
|
213 //# elif __has_cpp_attribute(carries_dependency) != 200809
|
|
214 //# error "__has_cpp_attribute(carries_dependency) != 200809"
|
|
215 //# endif
|
|
216 //#else
|
|
217 //# error "__has_cpp_attribute"
|
|
218 //#endif
|
|
219
|
|
220 // C++14 attributes:
|
|
221
|
|
222 #ifdef __has_cpp_attribute
|
|
223 # if ! __has_cpp_attribute(deprecated)
|
|
224 # error "__has_cpp_attribute(deprecated)"
|
|
225 # elif __has_cpp_attribute(deprecated) != 201309
|
|
226 # error "__has_cpp_attribute(deprecated) != 201309"
|
|
227 # endif
|
|
228 #else
|
|
229 # error "__has_cpp_attribute"
|
|
230 #endif
|
|
231
|
|
232 // Include checks:
|
|
233
|
|
234 // Check for __has_include macro.
|
|
235 #ifndef __has_include
|
|
236 # error "__has_include"
|
|
237 #endif
|
|
238
|
|
239 // Try known bracket header (use operator).
|
145
|
240 #if __has_include (<complex>)
|
111
|
241 #else
|
|
242 # error "<complex>"
|
|
243 #endif
|
|
244
|
|
245 // Define and use a macro to invoke the operator.
|
145
|
246 #define sluggo(TXT) __has_include(TXT)
|
111
|
247
|
|
248 #if sluggo(<complex>)
|
|
249 #else
|
|
250 # error "<complex>"
|
|
251 #endif
|
|
252
|
|
253 #if ! sluggo(<complex>)
|
|
254 # error "<complex>"
|
|
255 #else
|
|
256 #endif
|
|
257
|
|
258 // Quoted complex.h should find at least the bracket version.
|
|
259 #if __has_include("complex.h")
|
|
260 #else
|
|
261 # error "complex.h"
|
|
262 #endif
|
|
263
|
|
264 // Try known local quote header.
|
|
265 #if __has_include("complex_literals.h")
|
|
266 #else
|
|
267 # error "\"complex_literals.h\""
|
|
268 #endif
|
|
269
|
|
270 // Try nonexistent bracket header.
|
|
271 #if __has_include(<stuff>)
|
|
272 # error "<stuff>"
|
|
273 #else
|
|
274 #endif
|
|
275
|
|
276 // Try nonexistent quote header.
|
|
277 #if __has_include("phlegm")
|
|
278 # error "\"phlegm\""
|
|
279 #else
|
|
280 #endif
|
|
281
|
|
282 // Test __has_include_next.
|
|
283 #if __has_include("phoobhar.h")
|
|
284 # include "phoobhar.h"
|
|
285 #else
|
|
286 # error "__has_include(\"phoobhar.h\")"
|
|
287 #endif
|
|
288
|
|
289 // Try a macro.
|
|
290 #define COMPLEX_INC "complex.h"
|
|
291 #if __has_include(COMPLEX_INC)
|
|
292 #else
|
|
293 # error COMPLEX_INC
|
|
294 #endif
|
|
295
|
|
296 // Realistic use of __has_include.
|
|
297 #if __has_include(<array>)
|
|
298 # define STD_ARRAY 1
|
|
299 # include <array>
|
145
|
300 template<typename _Tp, std::size_t _Num>
|
111
|
301 using array = std::array<_Tp, _Num>;
|
|
302 #elif __has_include(<tr1/array>)
|
|
303 # define TR1_ARRAY 1
|
|
304 # include <tr1/array>
|
145
|
305 template<typename _Tp, std::size_t _Num>
|
111
|
306 typedef std::tr1::array<_Tp, _Num> array;
|
|
307 #endif
|