]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
Implement P0012R1, Make exception specifications part of the type system.
[gcc.git] / gcc / testsuite / g++.dg / cpp1z / feat-cxx1z.C
CommitLineData
adcef274
JM
1// { dg-options "-std=c++1z -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_raw_strings
20# error "__cpp_raw_strings"
21#elif __cpp_raw_strings != 200710
22# error "__cpp_raw_strings != 200710"
23#endif
24
25#ifndef __cpp_unicode_literals
26# error "__cpp_unicode_literals"
27#elif __cpp_unicode_literals != 200710
28# error "__cpp_unicode_literals != 200710"
29#endif
30
31#ifndef __cpp_user_defined_literals
32# error "__cpp_user_defined_literals"
33#elif __cpp_user_defined_literals != 200809
34# error "__cpp_user_defined_literals != 200809"
35#endif
36
37#ifndef __cpp_lambdas
38# error "__cpp_lambdas"
39#elif __cpp_lambdas != 200907
40# error "__cpp_lambdas != 200907"
41#endif
42
43#ifndef __cpp_range_based_for
44# error "__cpp_range_based_for"
322b8466
JM
45#elif __cpp_range_based_for != 201603
46# error "__cpp_range_based_for != 201603"
adcef274
JM
47#endif
48
49#ifndef __cpp_decltype
50# error "__cpp_decltype"
51#elif __cpp_decltype != 200707
52# error "__cpp_decltype != 200707"
53#endif
54
55#ifndef __cpp_attributes
56# error "__cpp_attributes"
57#elif __cpp_attributes != 200809
58# error "__cpp_attributes != 200809"
59#endif
60
98d44e93
MT
61#ifndef __cpp_rvalue_references
62# error "__cpp_rvalue_references"
63#elif __cpp_rvalue_references != 200610
64# error "__cpp_rvalue_references != 200610"
adcef274
JM
65#endif
66
67#ifndef __cpp_variadic_templates
68# error "__cpp_variadic_templates"
69#elif __cpp_variadic_templates != 200704
70# error "__cpp_variadic_templates != 200704"
71#endif
72
73#ifndef __cpp_initializer_lists
74# error "__cpp_initializer_lists"
75#elif __cpp_initializer_lists != 200806
76# error "__cpp_initializer_lists != 200806"
77#endif
78
79#ifndef __cpp_delegating_constructors
80# error "__cpp_delegating_constructors"
81#elif __cpp_delegating_constructors != 200604
82# error "__cpp_delegating_constructors != 200604"
83#endif
84
85#ifndef __cpp_nsdmi
86# error "__cpp_nsdmi"
87#elif __cpp_nsdmi != 200809
88# error "__cpp_nsdmi != 200809"
89#endif
90
91#ifndef __cpp_inheriting_constructors
92# error "__cpp_inheriting_constructors"
b302001e
JM
93#elif __cpp_inheriting_constructors!= 201511
94# error "__cpp_inheriting_constructors != 201511"
adcef274
JM
95#endif
96
97#ifndef __cpp_ref_qualifiers
98# error "__cpp_ref_qualifiers"
99#elif __cpp_ref_qualifiers != 200710
100# error "__cpp_ref_qualifiers != 200710"
101#endif
102
103#ifndef __cpp_alias_templates
104# error "__cpp_alias_templates"
105#elif __cpp_alias_templates != 200704
106# error "__cpp_alias_templates != 200704"
107#endif
108
109// C++14 features:
110
111#ifndef __cpp_binary_literals
112# error "__cpp_binary_literals"
113#elif __cpp_binary_literals != 201304
114# error "__cpp_binary_literals != 201304"
115#endif
116
117#ifndef __cpp_init_captures
118# error "__cpp_init_captures"
119#elif __cpp_init_captures != 201304
120# error "__cpp_init_captures != 201304"
121#endif
122
123#ifndef __cpp_generic_lambdas
124# error "__cpp_generic_lambdas"
125#elif __cpp_generic_lambdas != 201304
126# error "__cpp_generic_lambdas != 201304"
127#endif
128
129#ifndef __cpp_constexpr
130# error "__cpp_constexpr"
98e5a19a
JM
131#elif __cpp_constexpr != 201603
132# error "__cpp_constexpr != 201603"
adcef274
JM
133#endif
134
135#ifndef __cpp_decltype_auto
136# error "__cpp_decltype_auto"
137#elif __cpp_decltype_auto != 201304
138# error "__cpp_decltype_auto != 201304"
139#endif
140
141#ifndef __cpp_return_type_deduction
142# error "__cpp_return_type_deduction"
143#elif __cpp_return_type_deduction != 201304
144# error "__cpp_return_type_deduction != 201304"
145#endif
146
147#ifndef __cpp_aggregate_nsdmi
148# error "__cpp_aggregate_nsdmi"
149#elif __cpp_aggregate_nsdmi != 201304
150# error "__cpp_aggregate_nsdmi != 201304"
151#endif
152
153#ifndef __cpp_variable_templates
154# error "__cpp_variable_templates"
155#elif __cpp_variable_templates != 201304
156# error "__cpp_variable_templates != 201304"
157#endif
158
159#ifndef __cpp_digit_separators
160# error "__cpp_digit_separators"
161#elif __cpp_digit_separators != 201309
162# error "__cpp_digit_separators != 201309"
163#endif
164
165#ifndef __cpp_sized_deallocation
166# error "__cpp_sized_deallocation"
167#elif __cpp_sized_deallocation != 201309
168# error "__cpp_sized_deallocation != 201309"
169#endif
170
171// GNU VLA support:
172
173#ifndef __cpp_runtime_arrays
174# error "__cpp_runtime_arrays"
175#elif __cpp_runtime_arrays != 198712
176# error "__cpp_runtime_arrays != 198712"
177#endif
178
179// C++11 attributes:
180
181#ifdef __has_cpp_attribute
182# if ! __has_cpp_attribute(noreturn)
183# error "__has_cpp_attribute(noreturn)"
184# elif __has_cpp_attribute(noreturn) != 200809
185# error "__has_cpp_attribute(noreturn) != 200809"
186# endif
187#else
188# error "__has_cpp_attribute"
189#endif
190
191// Attribute carries_dependency not in yet.
192//#ifdef __has_cpp_attribute
193//# if ! __has_cpp_attribute(carries_dependency)
194//# error "__has_cpp_attribute(carries_dependency)"
195//# elif __has_cpp_attribute(carries_dependency) != 200809
196//# error "__has_cpp_attribute(carries_dependency) != 200809"
197//# endif
198//#else
199//# error "__has_cpp_attribute"
200//#endif
201
202// C++14 attributes:
203
204#ifdef __has_cpp_attribute
205# if ! __has_cpp_attribute(deprecated)
206# error "__has_cpp_attribute(deprecated)"
207# elif __has_cpp_attribute(deprecated) != 201309
208# error "__has_cpp_attribute(deprecated) != 201309"
209# endif
210#else
211# error "__has_cpp_attribute"
212#endif
213
214// Include checks:
215
216// Check for __has_include macro.
217#ifndef __has_include
218# error "__has_include"
219#endif
220
221// Quoted complex.h should find at least the bracket version (use operator).
222#if __has_include__ "complex.h"
223#else
224# error "complex.h"
225#endif
226
227// Try known bracket header (use operator).
228#if __has_include__(<complex>)
229#else
230# error "<complex>"
231#endif
232
233// Define and use a macro to invoke the operator.
234#define sluggo(TXT) __has_include__(TXT)
235
236#if sluggo(<complex>)
237#else
238# error "<complex>"
239#endif
240
241#if ! sluggo(<complex>)
242# error "<complex>"
243#else
244#endif
245
246// Quoted complex.h should find at least the bracket version.
247#if __has_include("complex.h")
248#else
249# error "complex.h"
250#endif
251
252// Try known local quote header.
253#if __has_include("complex_literals.h")
254#else
255# error "\"complex_literals.h\""
256#endif
257
258// Try nonexistent bracket header.
259#if __has_include(<stuff>)
260# error "<stuff>"
261#else
262#endif
263
264// Try nonexistent quote header.
265#if __has_include("phlegm")
266# error "\"phlegm\""
267#else
268#endif
269
270// Test __has_include_next.
271#if __has_include("phoobhar.h")
272# include "phoobhar.h"
273#else
274# error "__has_include(\"phoobhar.h\")"
275#endif
276
277// Try a macro.
278#define COMPLEX_INC "complex.h"
279#if __has_include(COMPLEX_INC)
280#else
281# error COMPLEX_INC
282#endif
283
284// Realistic use of __has_include.
285#if __has_include(<array>)
286# define STD_ARRAY 1
287# include <array>
288 template<typename _Tp, size_t _Num>
289 using array = std::array<_Tp, _Num>;
290#elif __has_include(<tr1/array>)
291# define TR1_ARRAY 1
292# include <tr1/array>
293 template<typename _Tp, size_t _Num>
294 typedef std::tr1::array<_Tp, _Num> array;
295#endif
296
297// C++17 features:
298
299#ifndef __cpp_unicode_characters
300# error "__cpp_unicode_characters"
301#elif __cpp_unicode_characters != 201411
302# error "__cpp_unicode_characters != 201411"
303#endif
329524f5
PC
304
305#ifndef __cpp_static_assert
306# error "__cpp_static_assert"
307#elif __cpp_static_assert != 201411
308# error "__cpp_static_assert != 201411"
309#endif
bdaaa8b7
VV
310
311#ifndef __cpp_namespace_attributes
312# error "__cpp_namespace_attributes"
313#elif __cpp_namespace_attributes != 201411
314# error "__cpp_namespace_attributes != 201411"
315#endif
316
adcef274
JM
317#ifndef __cpp_enumerator_attributes
318# error "__cpp_enumerator_attributes"
319#elif __cpp_enumerator_attributes != 201411
320# error "__cpp_enumerator_attributes != 201411"
321#endif
322
bdaaa8b7
VV
323#ifndef __cpp_nested_namespace_definitions
324# error "__cpp_nested_namespace_definitions"
325#elif __cpp_nested_namespace_definitions != 201411
326# error "__cpp_nested_namespace_definitions != 201411"
327#endif
adcef274
JM
328
329#ifndef __cpp_fold_expressions
330# error "__cpp_fold_expressions"
08da2581
JM
331#elif __cpp_fold_expressions != 201603
332# error "__cpp_fold_expressions != 201603"
adcef274
JM
333#endif
334
335#ifndef __cpp_nontype_template_args
336# error "__cpp_nontype_template_args"
337#elif __cpp_nontype_template_args != 201411
338# error "__cpp_nontype_template_args != 201411"
339#endif
2aaeea19
JM
340
341#ifndef __cpp_hex_float
342# error "__cpp_hex_float"
343#elif __cpp_hex_float != 201603
344# error "__cpp_hex_float != 201603"
345#endif
d067e05f 346
2045acd9
JM
347#ifndef __cpp_aggregate_bases
348# error "__cpp_aggregate_bases"
349#elif __cpp_aggregate_bases != 201603
350# error "__cpp_aggregate_bases != 201603"
351#endif
352
353#ifndef __cpp_deduction_guides
354# error "__cpp_deduction_guides"
355#elif __cpp_deduction_guides != 201606
356# error "__cpp_deduction_guides != 201606"
357#endif
358
452df4a4
JM
359#ifndef __cpp_if_constexpr
360# error "__cpp_if_constexpr"
361#elif __cpp_if_constexpr != 201606
362# error "__cpp_if_constexpr != 201606"
363#endif
364
af63ba4b
JM
365#ifndef __cpp_aligned_new
366# error "__cpp_aligned_new"
367#elif __cpp_aligned_new != 201606
368# error "__cpp_aligned_new != 201606"
369#endif
370
14a2c9aa
JM
371#ifndef __cpp_inline_variables
372# error "__cpp_inline_variables"
373#elif __cpp_inline_variables != 201606
374# error "__cpp_inline_variables != 201606"
375#endif
376
6e39060a
JJ
377#ifndef __cpp_capture_star_this
378# error "__cpp_capture_star_this"
379#elif __cpp_capture_star_this != 201603
380# error "__cpp_capture_star_this != 201603"
381#endif
382
51dc6603
JM
383#ifndef __cpp_noexcept_function_type
384# error "__cpp_noexcept_function_type"
385#elif __cpp_noexcept_function_type != 201510
386# error "__cpp_noexcept_function_type != 201510"
387#endif
388
d067e05f 389#ifdef __has_cpp_attribute
b632761d 390
d067e05f
JM
391# if ! __has_cpp_attribute(maybe_unused)
392# error "__has_cpp_attribute(maybe_unused)"
393# elif __has_cpp_attribute(maybe_unused) != 201603
394# error "__has_cpp_attribute(maybe_unused) != 201603"
395# endif
b632761d
JM
396
397# if ! __has_cpp_attribute(nodiscard)
398# error "__has_cpp_attribute(nodiscard)"
399# elif __has_cpp_attribute(nodiscard) != 201603
400# error "__has_cpp_attribute(nodiscard) != 201603"
401# endif
402
c6147dc4
MP
403# if ! __has_cpp_attribute(fallthrough)
404# error "__has_cpp_attribute(fallthrough)"
405# elif __has_cpp_attribute(fallthrough) != 201603
406# error "__has_cpp_attribute(fallthrough) != 201603"
407# endif
408
d067e05f
JM
409#else
410# error "__has_cpp_attribute"
411#endif
This page took 1.083241 seconds and 5 git commands to generate.