| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-add-options no_pch } |
| 3 |
|
| 4 |
#include <version> |
| 5 |
|
| 6 |
#ifndef __cpp_lib_variant |
| 7 |
#error "Feature test macro for variant is missing in <version>" |
| 8 |
#elif __cplusplus == 201703L && __cpp_lib_variant != 202102L |
| 9 |
# error "Feature test macro for variant has wrong value for C++17 in <version>" |
| 10 |
#elif __cplusplus >= 202002L && __cpp_lib_variant < 202106L |
| 11 |
# error "Feature test macro for variant has wrong value for C++20 in <version>" |
| 12 |
#endif |
| 13 |
|
| 14 |
#if __cplusplus >= 202302L |
| 15 |
#ifndef __cpp_lib_freestanding_variant |
| 16 |
# error "Feature test macro for freestanding std::variant is missing in <version>" |
| 17 |
#elif __cpp_lib_freestanding_variant < 202311L |
| 18 |
# error "Feature test macro for freestanding std::variant has wrong value in <version>" |
| 19 |
#endif |
| 20 |
#endif |
| 21 |
|
| 22 |
#undef __cpp_lib_variant |
| 23 |
#undef __cpp_lib_freestanding_variant |
| 24 |
#include <variant> |
| 25 |
|
| 26 |
#if __cplusplus >= 202302L |
| 27 |
#ifndef __cpp_lib_freestanding_variant |
| 28 |
# error "Feature test macro for freestanding std::variant is missing in <variant>" |
| 29 |
#elif __cpp_lib_freestanding_variant < 202311L |
| 30 |
# error "Feature test macro for freestanding std::variant has wrong value in <variant>" |
| 31 |
#endif |
| 32 |
#endif |