1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // WARNING: This test was generated by generate_feature_test_macro_components.py |
10 | // and should not be edited manually. |
11 | |
12 | // <optional> |
13 | |
14 | // Test the feature test macros defined by <optional> |
15 | |
16 | // clang-format off |
17 | |
18 | #include <optional> |
19 | #include "test_macros.h" |
20 | |
21 | #if TEST_STD_VER < 14 |
22 | |
23 | # ifdef __cpp_lib_constrained_equality |
24 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
25 | # endif |
26 | |
27 | # ifdef __cpp_lib_freestanding_optional |
28 | # error "__cpp_lib_freestanding_optional should not be defined before c++26" |
29 | # endif |
30 | |
31 | # ifdef __cpp_lib_optional |
32 | # error "__cpp_lib_optional should not be defined before c++17" |
33 | # endif |
34 | |
35 | # ifdef __cpp_lib_optional_range_support |
36 | # error "__cpp_lib_optional_range_support should not be defined before c++26" |
37 | # endif |
38 | |
39 | #elif TEST_STD_VER == 14 |
40 | |
41 | # ifdef __cpp_lib_constrained_equality |
42 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
43 | # endif |
44 | |
45 | # ifdef __cpp_lib_freestanding_optional |
46 | # error "__cpp_lib_freestanding_optional should not be defined before c++26" |
47 | # endif |
48 | |
49 | # ifdef __cpp_lib_optional |
50 | # error "__cpp_lib_optional should not be defined before c++17" |
51 | # endif |
52 | |
53 | # ifdef __cpp_lib_optional_range_support |
54 | # error "__cpp_lib_optional_range_support should not be defined before c++26" |
55 | # endif |
56 | |
57 | #elif TEST_STD_VER == 17 |
58 | |
59 | # ifdef __cpp_lib_constrained_equality |
60 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
61 | # endif |
62 | |
63 | # ifdef __cpp_lib_freestanding_optional |
64 | # error "__cpp_lib_freestanding_optional should not be defined before c++26" |
65 | # endif |
66 | |
67 | # ifndef __cpp_lib_optional |
68 | # error "__cpp_lib_optional should be defined in c++17" |
69 | # endif |
70 | # if __cpp_lib_optional != 201606L |
71 | # error "__cpp_lib_optional should have the value 201606L in c++17" |
72 | # endif |
73 | |
74 | # ifdef __cpp_lib_optional_range_support |
75 | # error "__cpp_lib_optional_range_support should not be defined before c++26" |
76 | # endif |
77 | |
78 | #elif TEST_STD_VER == 20 |
79 | |
80 | # ifdef __cpp_lib_constrained_equality |
81 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
82 | # endif |
83 | |
84 | # ifdef __cpp_lib_freestanding_optional |
85 | # error "__cpp_lib_freestanding_optional should not be defined before c++26" |
86 | # endif |
87 | |
88 | # ifndef __cpp_lib_optional |
89 | # error "__cpp_lib_optional should be defined in c++20" |
90 | # endif |
91 | # if __cpp_lib_optional != 202106L |
92 | # error "__cpp_lib_optional should have the value 202106L in c++20" |
93 | # endif |
94 | |
95 | # ifdef __cpp_lib_optional_range_support |
96 | # error "__cpp_lib_optional_range_support should not be defined before c++26" |
97 | # endif |
98 | |
99 | #elif TEST_STD_VER == 23 |
100 | |
101 | # ifdef __cpp_lib_constrained_equality |
102 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
103 | # endif |
104 | |
105 | # ifdef __cpp_lib_freestanding_optional |
106 | # error "__cpp_lib_freestanding_optional should not be defined before c++26" |
107 | # endif |
108 | |
109 | # ifndef __cpp_lib_optional |
110 | # error "__cpp_lib_optional should be defined in c++23" |
111 | # endif |
112 | # if __cpp_lib_optional != 202110L |
113 | # error "__cpp_lib_optional should have the value 202110L in c++23" |
114 | # endif |
115 | |
116 | # ifdef __cpp_lib_optional_range_support |
117 | # error "__cpp_lib_optional_range_support should not be defined before c++26" |
118 | # endif |
119 | |
120 | #elif TEST_STD_VER > 23 |
121 | |
122 | # if !defined(_LIBCPP_VERSION) |
123 | # ifndef __cpp_lib_constrained_equality |
124 | # error "__cpp_lib_constrained_equality should be defined in c++26" |
125 | # endif |
126 | # if __cpp_lib_constrained_equality != 202403L |
127 | # error "__cpp_lib_constrained_equality should have the value 202403L in c++26" |
128 | # endif |
129 | # else |
130 | # ifdef __cpp_lib_constrained_equality |
131 | # error "__cpp_lib_constrained_equality should not be defined because it is unimplemented in libc++!" |
132 | # endif |
133 | # endif |
134 | |
135 | # if !defined(_LIBCPP_VERSION) |
136 | # ifndef __cpp_lib_freestanding_optional |
137 | # error "__cpp_lib_freestanding_optional should be defined in c++26" |
138 | # endif |
139 | # if __cpp_lib_freestanding_optional != 202311L |
140 | # error "__cpp_lib_freestanding_optional should have the value 202311L in c++26" |
141 | # endif |
142 | # else |
143 | # ifdef __cpp_lib_freestanding_optional |
144 | # error "__cpp_lib_freestanding_optional should not be defined because it is unimplemented in libc++!" |
145 | # endif |
146 | # endif |
147 | |
148 | # ifndef __cpp_lib_optional |
149 | # error "__cpp_lib_optional should be defined in c++26" |
150 | # endif |
151 | # if __cpp_lib_optional != 202110L |
152 | # error "__cpp_lib_optional should have the value 202110L in c++26" |
153 | # endif |
154 | |
155 | # if !defined(_LIBCPP_VERSION) |
156 | # ifndef __cpp_lib_optional_range_support |
157 | # error "__cpp_lib_optional_range_support should be defined in c++26" |
158 | # endif |
159 | # if __cpp_lib_optional_range_support != 202406L |
160 | # error "__cpp_lib_optional_range_support should have the value 202406L in c++26" |
161 | # endif |
162 | # else |
163 | # ifdef __cpp_lib_optional_range_support |
164 | # error "__cpp_lib_optional_range_support should not be defined because it is unimplemented in libc++!" |
165 | # endif |
166 | # endif |
167 | |
168 | #endif // TEST_STD_VER > 23 |
169 | |
170 | // clang-format on |
171 | |
172 | |