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// <bit>
13
14// Test the feature test macros defined by <bit>
15
16// clang-format off
17
18#include <bit>
19#include "test_macros.h"
20
21#if TEST_STD_VER < 14
22
23# ifdef __cpp_lib_bit_cast
24# error "__cpp_lib_bit_cast should not be defined before c++20"
25# endif
26
27# ifdef __cpp_lib_bitops
28# error "__cpp_lib_bitops should not be defined before c++20"
29# endif
30
31# ifdef __cpp_lib_byteswap
32# error "__cpp_lib_byteswap should not be defined before c++23"
33# endif
34
35# ifdef __cpp_lib_endian
36# error "__cpp_lib_endian should not be defined before c++20"
37# endif
38
39# ifdef __cpp_lib_int_pow2
40# error "__cpp_lib_int_pow2 should not be defined before c++20"
41# endif
42
43#elif TEST_STD_VER == 14
44
45# ifdef __cpp_lib_bit_cast
46# error "__cpp_lib_bit_cast should not be defined before c++20"
47# endif
48
49# ifdef __cpp_lib_bitops
50# error "__cpp_lib_bitops should not be defined before c++20"
51# endif
52
53# ifdef __cpp_lib_byteswap
54# error "__cpp_lib_byteswap should not be defined before c++23"
55# endif
56
57# ifdef __cpp_lib_endian
58# error "__cpp_lib_endian should not be defined before c++20"
59# endif
60
61# ifdef __cpp_lib_int_pow2
62# error "__cpp_lib_int_pow2 should not be defined before c++20"
63# endif
64
65#elif TEST_STD_VER == 17
66
67# ifdef __cpp_lib_bit_cast
68# error "__cpp_lib_bit_cast should not be defined before c++20"
69# endif
70
71# ifdef __cpp_lib_bitops
72# error "__cpp_lib_bitops should not be defined before c++20"
73# endif
74
75# ifdef __cpp_lib_byteswap
76# error "__cpp_lib_byteswap should not be defined before c++23"
77# endif
78
79# ifdef __cpp_lib_endian
80# error "__cpp_lib_endian should not be defined before c++20"
81# endif
82
83# ifdef __cpp_lib_int_pow2
84# error "__cpp_lib_int_pow2 should not be defined before c++20"
85# endif
86
87#elif TEST_STD_VER == 20
88
89# ifndef __cpp_lib_bit_cast
90# error "__cpp_lib_bit_cast should be defined in c++20"
91# endif
92# if __cpp_lib_bit_cast != 201806L
93# error "__cpp_lib_bit_cast should have the value 201806L in c++20"
94# endif
95
96# ifndef __cpp_lib_bitops
97# error "__cpp_lib_bitops should be defined in c++20"
98# endif
99# if __cpp_lib_bitops != 201907L
100# error "__cpp_lib_bitops should have the value 201907L in c++20"
101# endif
102
103# ifdef __cpp_lib_byteswap
104# error "__cpp_lib_byteswap should not be defined before c++23"
105# endif
106
107# ifndef __cpp_lib_endian
108# error "__cpp_lib_endian should be defined in c++20"
109# endif
110# if __cpp_lib_endian != 201907L
111# error "__cpp_lib_endian should have the value 201907L in c++20"
112# endif
113
114# ifndef __cpp_lib_int_pow2
115# error "__cpp_lib_int_pow2 should be defined in c++20"
116# endif
117# if __cpp_lib_int_pow2 != 202002L
118# error "__cpp_lib_int_pow2 should have the value 202002L in c++20"
119# endif
120
121#elif TEST_STD_VER == 23
122
123# ifndef __cpp_lib_bit_cast
124# error "__cpp_lib_bit_cast should be defined in c++23"
125# endif
126# if __cpp_lib_bit_cast != 201806L
127# error "__cpp_lib_bit_cast should have the value 201806L in c++23"
128# endif
129
130# ifndef __cpp_lib_bitops
131# error "__cpp_lib_bitops should be defined in c++23"
132# endif
133# if __cpp_lib_bitops != 201907L
134# error "__cpp_lib_bitops should have the value 201907L in c++23"
135# endif
136
137# ifndef __cpp_lib_byteswap
138# error "__cpp_lib_byteswap should be defined in c++23"
139# endif
140# if __cpp_lib_byteswap != 202110L
141# error "__cpp_lib_byteswap should have the value 202110L in c++23"
142# endif
143
144# ifndef __cpp_lib_endian
145# error "__cpp_lib_endian should be defined in c++23"
146# endif
147# if __cpp_lib_endian != 201907L
148# error "__cpp_lib_endian should have the value 201907L in c++23"
149# endif
150
151# ifndef __cpp_lib_int_pow2
152# error "__cpp_lib_int_pow2 should be defined in c++23"
153# endif
154# if __cpp_lib_int_pow2 != 202002L
155# error "__cpp_lib_int_pow2 should have the value 202002L in c++23"
156# endif
157
158#elif TEST_STD_VER > 23
159
160# ifndef __cpp_lib_bit_cast
161# error "__cpp_lib_bit_cast should be defined in c++26"
162# endif
163# if __cpp_lib_bit_cast != 201806L
164# error "__cpp_lib_bit_cast should have the value 201806L in c++26"
165# endif
166
167# ifndef __cpp_lib_bitops
168# error "__cpp_lib_bitops should be defined in c++26"
169# endif
170# if __cpp_lib_bitops != 201907L
171# error "__cpp_lib_bitops should have the value 201907L in c++26"
172# endif
173
174# ifndef __cpp_lib_byteswap
175# error "__cpp_lib_byteswap should be defined in c++26"
176# endif
177# if __cpp_lib_byteswap != 202110L
178# error "__cpp_lib_byteswap should have the value 202110L in c++26"
179# endif
180
181# ifndef __cpp_lib_endian
182# error "__cpp_lib_endian should be defined in c++26"
183# endif
184# if __cpp_lib_endian != 201907L
185# error "__cpp_lib_endian should have the value 201907L in c++26"
186# endif
187
188# ifndef __cpp_lib_int_pow2
189# error "__cpp_lib_int_pow2 should be defined in c++26"
190# endif
191# if __cpp_lib_int_pow2 != 202002L
192# error "__cpp_lib_int_pow2 should have the value 202002L in c++26"
193# endif
194
195#endif // TEST_STD_VER > 23
196
197// clang-format on
198
199

source code of libcxx/test/std/language.support/support.limits/support.limits.general/bit.version.compile.pass.cpp