Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 // { dg-do compile { target c++17 } } | 1 // { dg-do compile } |
2 // { dg-options "-I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" } | 2 // { dg-options "-std=c++17 -I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" } |
3 | 3 |
4 // C++98 features: | 4 // C++98 features: |
5 | 5 |
6 #ifndef __cpp_rtti | 6 #ifndef __cpp_rtti |
7 # error "__cpp_rtti" | 7 # error "__cpp_rtti" |
223 // Check for __has_include macro. | 223 // Check for __has_include macro. |
224 #ifndef __has_include | 224 #ifndef __has_include |
225 # error "__has_include" | 225 # error "__has_include" |
226 #endif | 226 #endif |
227 | 227 |
228 // Quoted complex.h should find at least the bracket version (use operator). | |
229 #if __has_include__ "complex.h" | |
230 #else | |
231 # error "complex.h" | |
232 #endif | |
233 | |
234 // Try known bracket header (use operator). | 228 // Try known bracket header (use operator). |
235 #if __has_include__(<complex>) | 229 #if __has_include (<complex>) |
236 #else | 230 #else |
237 # error "<complex>" | 231 # error "<complex>" |
238 #endif | 232 #endif |
239 | 233 |
240 // Define and use a macro to invoke the operator. | 234 // Define and use a macro to invoke the operator. |
241 #define sluggo(TXT) __has_include__(TXT) | 235 #define sluggo(TXT) __has_include(TXT) |
242 | 236 |
243 #if sluggo(<complex>) | 237 #if sluggo(<complex>) |
244 #else | 238 #else |
245 # error "<complex>" | 239 # error "<complex>" |
246 #endif | 240 #endif |
290 | 284 |
291 // Realistic use of __has_include. | 285 // Realistic use of __has_include. |
292 #if __has_include(<array>) | 286 #if __has_include(<array>) |
293 # define STD_ARRAY 1 | 287 # define STD_ARRAY 1 |
294 # include <array> | 288 # include <array> |
295 template<typename _Tp, size_t _Num> | 289 template<typename _Tp, std::size_t _Num> |
296 using array = std::array<_Tp, _Num>; | 290 using array = std::array<_Tp, _Num>; |
297 #elif __has_include(<tr1/array>) | 291 #elif __has_include(<tr1/array>) |
298 # define TR1_ARRAY 1 | 292 # define TR1_ARRAY 1 |
299 # include <tr1/array> | 293 # include <tr1/array> |
300 template<typename _Tp, size_t _Num> | 294 template<typename _Tp, std::size_t _Num> |
301 typedef std::tr1::array<_Tp, _Num> array; | 295 typedef std::tr1::array<_Tp, _Num> array; |
302 #endif | 296 #endif |
303 | 297 |
304 // C++17 features: | 298 // C++17 features: |
305 | 299 |
413 | 407 |
414 #ifndef __cpp_variadic_using | 408 #ifndef __cpp_variadic_using |
415 # error "__cpp_variadic_using" | 409 # error "__cpp_variadic_using" |
416 #elif __cpp_variadic_using != 201611 | 410 #elif __cpp_variadic_using != 201611 |
417 # error "__cpp_variadic_using != 201611" | 411 # error "__cpp_variadic_using != 201611" |
412 #endif | |
413 | |
414 #ifndef __cpp_guaranteed_copy_elision | |
415 # error "__cpp_guaranteed_copy_elision" | |
416 #elif __cpp_guaranteed_copy_elision != 201606 | |
417 # error "__cpp_guaranteed_copy_elision != 201606" | |
418 #endif | |
419 | |
420 #ifndef __cpp_nontype_template_parameter_auto | |
421 # error "__cpp_nontype_template_parameter_auto" | |
422 #elif __cpp_nontype_template_parameter_auto != 201606 | |
423 # error "__cpp_nontype_template_parameter_auto != 201606" | |
418 #endif | 424 #endif |
419 | 425 |
420 #ifdef __has_cpp_attribute | 426 #ifdef __has_cpp_attribute |
421 | 427 |
422 # if ! __has_cpp_attribute(maybe_unused) | 428 # if ! __has_cpp_attribute(maybe_unused) |
425 # error "__has_cpp_attribute(maybe_unused) != 201603" | 431 # error "__has_cpp_attribute(maybe_unused) != 201603" |
426 # endif | 432 # endif |
427 | 433 |
428 # if ! __has_cpp_attribute(nodiscard) | 434 # if ! __has_cpp_attribute(nodiscard) |
429 # error "__has_cpp_attribute(nodiscard)" | 435 # error "__has_cpp_attribute(nodiscard)" |
430 # elif __has_cpp_attribute(nodiscard) != 201603 | 436 # elif (__has_cpp_attribute(nodiscard) != 201603 && __has_cpp_attribute(nodiscard) != 201907) |
431 # error "__has_cpp_attribute(nodiscard) != 201603" | 437 # error "__has_cpp_attribute(nodiscard) != 201603" |
432 # endif | 438 # endif |
433 | 439 |
434 # if ! __has_cpp_attribute(fallthrough) | 440 # if ! __has_cpp_attribute(fallthrough) |
435 # error "__has_cpp_attribute(fallthrough)" | 441 # error "__has_cpp_attribute(fallthrough)" |