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 | // <variant> |
13 | |
14 | // Test the feature test macros defined by <variant> |
15 | |
16 | // clang-format off |
17 | |
18 | #include <variant> |
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_variant |
28 | # error "__cpp_lib_freestanding_variant should not be defined before c++26" |
29 | # endif |
30 | |
31 | # ifdef __cpp_lib_variant |
32 | # error "__cpp_lib_variant should not be defined before c++17" |
33 | # endif |
34 | |
35 | #elif TEST_STD_VER == 14 |
36 | |
37 | # ifdef __cpp_lib_constrained_equality |
38 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
39 | # endif |
40 | |
41 | # ifdef __cpp_lib_freestanding_variant |
42 | # error "__cpp_lib_freestanding_variant should not be defined before c++26" |
43 | # endif |
44 | |
45 | # ifdef __cpp_lib_variant |
46 | # error "__cpp_lib_variant should not be defined before c++17" |
47 | # endif |
48 | |
49 | #elif TEST_STD_VER == 17 |
50 | |
51 | # ifdef __cpp_lib_constrained_equality |
52 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
53 | # endif |
54 | |
55 | # ifdef __cpp_lib_freestanding_variant |
56 | # error "__cpp_lib_freestanding_variant should not be defined before c++26" |
57 | # endif |
58 | |
59 | # ifndef __cpp_lib_variant |
60 | # error "__cpp_lib_variant should be defined in c++17" |
61 | # endif |
62 | # if __cpp_lib_variant != 202102L |
63 | # error "__cpp_lib_variant should have the value 202102L in c++17" |
64 | # endif |
65 | |
66 | #elif TEST_STD_VER == 20 |
67 | |
68 | # ifdef __cpp_lib_constrained_equality |
69 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
70 | # endif |
71 | |
72 | # ifdef __cpp_lib_freestanding_variant |
73 | # error "__cpp_lib_freestanding_variant should not be defined before c++26" |
74 | # endif |
75 | |
76 | # ifndef __cpp_lib_variant |
77 | # error "__cpp_lib_variant should be defined in c++20" |
78 | # endif |
79 | # if __cpp_lib_variant != 202106L |
80 | # error "__cpp_lib_variant should have the value 202106L in c++20" |
81 | # endif |
82 | |
83 | #elif TEST_STD_VER == 23 |
84 | |
85 | # ifdef __cpp_lib_constrained_equality |
86 | # error "__cpp_lib_constrained_equality should not be defined before c++26" |
87 | # endif |
88 | |
89 | # ifdef __cpp_lib_freestanding_variant |
90 | # error "__cpp_lib_freestanding_variant should not be defined before c++26" |
91 | # endif |
92 | |
93 | # ifndef __cpp_lib_variant |
94 | # error "__cpp_lib_variant should be defined in c++23" |
95 | # endif |
96 | # if __cpp_lib_variant != 202106L |
97 | # error "__cpp_lib_variant should have the value 202106L in c++23" |
98 | # endif |
99 | |
100 | #elif TEST_STD_VER > 23 |
101 | |
102 | # if !defined(_LIBCPP_VERSION) |
103 | # ifndef __cpp_lib_constrained_equality |
104 | # error "__cpp_lib_constrained_equality should be defined in c++26" |
105 | # endif |
106 | # if __cpp_lib_constrained_equality != 202403L |
107 | # error "__cpp_lib_constrained_equality should have the value 202403L in c++26" |
108 | # endif |
109 | # else |
110 | # ifdef __cpp_lib_constrained_equality |
111 | # error "__cpp_lib_constrained_equality should not be defined because it is unimplemented in libc++!" |
112 | # endif |
113 | # endif |
114 | |
115 | # if !defined(_LIBCPP_VERSION) |
116 | # ifndef __cpp_lib_freestanding_variant |
117 | # error "__cpp_lib_freestanding_variant should be defined in c++26" |
118 | # endif |
119 | # if __cpp_lib_freestanding_variant != 202311L |
120 | # error "__cpp_lib_freestanding_variant should have the value 202311L in c++26" |
121 | # endif |
122 | # else |
123 | # ifdef __cpp_lib_freestanding_variant |
124 | # error "__cpp_lib_freestanding_variant should not be defined because it is unimplemented in libc++!" |
125 | # endif |
126 | # endif |
127 | |
128 | # ifndef __cpp_lib_variant |
129 | # error "__cpp_lib_variant should be defined in c++26" |
130 | # endif |
131 | # if __cpp_lib_variant != 202306L |
132 | # error "__cpp_lib_variant should have the value 202306L in c++26" |
133 | # endif |
134 | |
135 | #endif // TEST_STD_VER > 23 |
136 | |
137 | // clang-format on |
138 | |
139 | |