blob: ba44aa525356e65b10b6cc4ec03bac2d23c5b4c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// { dg-do compile { target c++17 } }
// { dg-add-options no_pch }
#include <version>
#ifndef __cpp_lib_optional
# error "Feature test macro for optional is missing in <version>"
#elif __cplusplus == 201703L && __cpp_lib_optional != 201606L
# error "Feature test macro for optional has wrong value for C++17 in <version>"
#elif __cplusplus == 202002L && __cpp_lib_optional != 202106L
# error "Feature test macro for optional has wrong value for C++20 in <version>"
#elif __cplusplus > 202002L && __cpp_lib_optional != 202110L
# error "Feature test macro for optional has wrong value for C++23 in <version>"
#endif
#if __cplusplus >= 202302L
#ifndef __cpp_lib_freestanding_optional
# error "Feature test macro for freestanding std::optional is missing in <version>"
#elif __cpp_lib_freestanding_optional < 202311L
# error "Feature test macro for freestanding std::optional has wrong value in <version>"
#endif
#endif
#if __cplusplus > 202302L
# ifndef __cpp_lib_optional_range_support
# error "Feature test macro for optional range support is missing in <version>"
# elif __cpp_lib_optional_range_support != 202406L
# error "Feature test macro for optional range support has wrong value for C++26 in <version>"
# endif
#endif
#undef __cpp_lib_optional
#undef __cpp_lib_freestanding_optional
#undef __cpp_lib_optional_range_support
#include <optional>
#if __cplusplus >= 202302L
#ifndef __cpp_lib_freestanding_optional
# error "Feature test macro for freestanding std::optional is missing in <optional>"
#elif __cpp_lib_freestanding_optional < 202311L
# error "Feature test macro for freestanding std::optional has wrong value in <optional>"
#endif
#endif
#if __cplusplus > 202302L
# ifndef __cpp_lib_optional_range_support
# error "Feature test macro for optional range support is missing in <optional>"
# endif
# if __cpp_lib_optional_range_support != 202406L
# error "Feature test macro for optional range support has wrong value for C++26 in <optional>"
# endif
#endif
|