Debian Codegraph @

libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp

raw
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 // clang-format off
13
14 // <optional>
15
16 // Test the feature test macros defined by <optional>
17
18 /* Constant Value
19 __cpp_lib_constrained_equality 202403L [C++26]
20 __cpp_lib_freestanding_optional 202311L [C++26]
21 __cpp_lib_optional 201606L [C++17]
22 202110L [C++23]
23 __cpp_lib_optional_range_support 202406L [C++26]
24 */
25
26 #include <optional>
27 #include "test_macros.h"
28
29 #if TEST_STD_VER < 14
30
31 # ifdef __cpp_lib_constrained_equality
32 # error "__cpp_lib_constrained_equality should not be defined before c++26"
33 # endif
34
35 # ifdef __cpp_lib_freestanding_optional
36 # error "__cpp_lib_freestanding_optional should not be defined before c++26"
37 # endif
38
39 # ifdef __cpp_lib_optional
40 # error "__cpp_lib_optional should not be defined before c++17"
41 # endif
42
43 # ifdef __cpp_lib_optional_range_support
44 # error "__cpp_lib_optional_range_support should not be defined before c++26"
45 # endif
46
47 #elif TEST_STD_VER == 14
48
49 # ifdef __cpp_lib_constrained_equality
50 # error "__cpp_lib_constrained_equality should not be defined before c++26"
51 # endif
52
53 # ifdef __cpp_lib_freestanding_optional
54 # error "__cpp_lib_freestanding_optional should not be defined before c++26"
55 # endif
56
57 # ifdef __cpp_lib_optional
58 # error "__cpp_lib_optional should not be defined before c++17"
59 # endif
60
61 # ifdef __cpp_lib_optional_range_support
62 # error "__cpp_lib_optional_range_support should not be defined before c++26"
63 # endif
64
65 #elif TEST_STD_VER == 17
66
67 # ifdef __cpp_lib_constrained_equality
68 # error "__cpp_lib_constrained_equality should not be defined before c++26"
69 # endif
70
71 # ifdef __cpp_lib_freestanding_optional
72 # error "__cpp_lib_freestanding_optional should not be defined before c++26"
73 # endif
74
75 # ifndef __cpp_lib_optional
76 # error "__cpp_lib_optional should be defined in c++17"
77 # endif
78 # if __cpp_lib_optional != 201606L
79 # error "__cpp_lib_optional should have the value 201606L in c++17"
80 # endif
81
82 # ifdef __cpp_lib_optional_range_support
83 # error "__cpp_lib_optional_range_support should not be defined before c++26"
84 # endif
85
86 #elif TEST_STD_VER == 20
87
88 # ifdef __cpp_lib_constrained_equality
89 # error "__cpp_lib_constrained_equality should not be defined before c++26"
90 # endif
91
92 # ifdef __cpp_lib_freestanding_optional
93 # error "__cpp_lib_freestanding_optional should not be defined before c++26"
94 # endif
95
96 # ifndef __cpp_lib_optional
97 # error "__cpp_lib_optional should be defined in c++20"
98 # endif
99 # if __cpp_lib_optional != 201606L
100 # error "__cpp_lib_optional should have the value 201606L in c++20"
101 # endif
102
103 # ifdef __cpp_lib_optional_range_support
104 # error "__cpp_lib_optional_range_support should not be defined before c++26"
105 # endif
106
107 #elif TEST_STD_VER == 23
108
109 # ifdef __cpp_lib_constrained_equality
110 # error "__cpp_lib_constrained_equality should not be defined before c++26"
111 # endif
112
113 # ifdef __cpp_lib_freestanding_optional
114 # error "__cpp_lib_freestanding_optional should not be defined before c++26"
115 # endif
116
117 # ifndef __cpp_lib_optional
118 # error "__cpp_lib_optional should be defined in c++23"
119 # endif
120 # if __cpp_lib_optional != 202110L
121 # error "__cpp_lib_optional should have the value 202110L in c++23"
122 # endif
123
124 # ifdef __cpp_lib_optional_range_support
125 # error "__cpp_lib_optional_range_support should not be defined before c++26"
126 # endif
127
128 #elif TEST_STD_VER > 23
129
130 # if !defined(_LIBCPP_VERSION)
131 # ifndef __cpp_lib_constrained_equality
132 # error "__cpp_lib_constrained_equality should be defined in c++26"
133 # endif
134 # if __cpp_lib_constrained_equality != 202403L
135 # error "__cpp_lib_constrained_equality should have the value 202403L in c++26"
136 # endif
137 # else // _LIBCPP_VERSION
138 # ifdef __cpp_lib_constrained_equality
139 # error "__cpp_lib_constrained_equality should not be defined because it is unimplemented in libc++!"
140 # endif
141 # endif
142
143 # if !defined(_LIBCPP_VERSION)
144 # ifndef __cpp_lib_freestanding_optional
145 # error "__cpp_lib_freestanding_optional should be defined in c++26"
146 # endif
147 # if __cpp_lib_freestanding_optional != 202311L
148 # error "__cpp_lib_freestanding_optional should have the value 202311L in c++26"
149 # endif
150 # else // _LIBCPP_VERSION
151 # ifdef __cpp_lib_freestanding_optional
152 # error "__cpp_lib_freestanding_optional should not be defined because it is unimplemented in libc++!"
153 # endif
154 # endif
155
156 # ifndef __cpp_lib_optional
157 # error "__cpp_lib_optional should be defined in c++26"
158 # endif
159 # if __cpp_lib_optional != 202110L
160 # error "__cpp_lib_optional should have the value 202110L in c++26"
161 # endif
162
163 # if !defined(_LIBCPP_VERSION)
164 # ifndef __cpp_lib_optional_range_support
165 # error "__cpp_lib_optional_range_support should be defined in c++26"
166 # endif
167 # if __cpp_lib_optional_range_support != 202406L
168 # error "__cpp_lib_optional_range_support should have the value 202406L in c++26"
169 # endif
170 # else // _LIBCPP_VERSION
171 # ifdef __cpp_lib_optional_range_support
172 # error "__cpp_lib_optional_range_support should not be defined because it is unimplemented in libc++!"
173 # endif
174 # endif
175
176 #endif // TEST_STD_VER > 23
177