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 // <new> 15 16 // Test the feature test macros defined by <new> 17 18 /* Constant Value 19 __cpp_lib_constexpr_new 202406L [C++26] 20 __cpp_lib_destroying_delete 201806L [C++20] 21 __cpp_lib_hardware_interference_size 201703L [C++17] 22 __cpp_lib_launder 201606L [C++17] 23 */ 24 25 #include <new> 26 #include "test_macros.h" 27 28 #if TEST_STD_VER < 14 29 30 # ifdef __cpp_lib_constexpr_new 31 # error "__cpp_lib_constexpr_new should not be defined before c++26" 32 # endif 33 34 # ifdef __cpp_lib_destroying_delete 35 # error "__cpp_lib_destroying_delete should not be defined before c++20" 36 # endif 37 38 # ifdef __cpp_lib_hardware_interference_size 39 # error "__cpp_lib_hardware_interference_size should not be defined before c++17" 40 # endif 41 42 # ifdef __cpp_lib_launder 43 # error "__cpp_lib_launder should not be defined before c++17" 44 # endif 45 46 #elif TEST_STD_VER == 14 47 48 # ifdef __cpp_lib_constexpr_new 49 # error "__cpp_lib_constexpr_new should not be defined before c++26" 50 # endif 51 52 # ifdef __cpp_lib_destroying_delete 53 # error "__cpp_lib_destroying_delete should not be defined before c++20" 54 # endif 55 56 # ifdef __cpp_lib_hardware_interference_size 57 # error "__cpp_lib_hardware_interference_size should not be defined before c++17" 58 # endif 59 60 # ifdef __cpp_lib_launder 61 # error "__cpp_lib_launder should not be defined before c++17" 62 # endif 63 64 #elif TEST_STD_VER == 17 65 66 # ifdef __cpp_lib_constexpr_new 67 # error "__cpp_lib_constexpr_new should not be defined before c++26" 68 # endif 69 70 # ifdef __cpp_lib_destroying_delete 71 # error "__cpp_lib_destroying_delete should not be defined before c++20" 72 # endif 73 74 # if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)) 75 # ifndef __cpp_lib_hardware_interference_size 76 # error "__cpp_lib_hardware_interference_size should be defined in c++17" 77 # endif 78 # if __cpp_lib_hardware_interference_size != 201703L 79 # error "__cpp_lib_hardware_interference_size should have the value 201703L in c++17" 80 # endif 81 # else 82 # ifdef __cpp_lib_hardware_interference_size 83 # error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!" 84 # endif 85 # endif 86 87 # ifndef __cpp_lib_launder 88 # error "__cpp_lib_launder should be defined in c++17" 89 # endif 90 # if __cpp_lib_launder != 201606L 91 # error "__cpp_lib_launder should have the value 201606L in c++17" 92 # endif 93 94 #elif TEST_STD_VER == 20 95 96 # ifdef __cpp_lib_constexpr_new 97 # error "__cpp_lib_constexpr_new should not be defined before c++26" 98 # endif 99 100 # if TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L 101 # ifndef __cpp_lib_destroying_delete 102 # error "__cpp_lib_destroying_delete should be defined in c++20" 103 # endif 104 # if __cpp_lib_destroying_delete != 201806L 105 # error "__cpp_lib_destroying_delete should have the value 201806L in c++20" 106 # endif 107 # else 108 # ifdef __cpp_lib_destroying_delete 109 # error "__cpp_lib_destroying_delete should not be defined when the requirement 'TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!" 110 # endif 111 # endif 112 113 # if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)) 114 # ifndef __cpp_lib_hardware_interference_size 115 # error "__cpp_lib_hardware_interference_size should be defined in c++20" 116 # endif 117 # if __cpp_lib_hardware_interference_size != 201703L 118 # error "__cpp_lib_hardware_interference_size should have the value 201703L in c++20" 119 # endif 120 # else 121 # ifdef __cpp_lib_hardware_interference_size 122 # error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!" 123 # endif 124 # endif 125 126 # ifndef __cpp_lib_launder 127 # error "__cpp_lib_launder should be defined in c++20" 128 # endif 129 # if __cpp_lib_launder != 201606L 130 # error "__cpp_lib_launder should have the value 201606L in c++20" 131 # endif 132 133 #elif TEST_STD_VER == 23 134 135 # ifdef __cpp_lib_constexpr_new 136 # error "__cpp_lib_constexpr_new should not be defined before c++26" 137 # endif 138 139 # if TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L 140 # ifndef __cpp_lib_destroying_delete 141 # error "__cpp_lib_destroying_delete should be defined in c++23" 142 # endif 143 # if __cpp_lib_destroying_delete != 201806L 144 # error "__cpp_lib_destroying_delete should have the value 201806L in c++23" 145 # endif 146 # else 147 # ifdef __cpp_lib_destroying_delete 148 # error "__cpp_lib_destroying_delete should not be defined when the requirement 'TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!" 149 # endif 150 # endif 151 152 # if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)) 153 # ifndef __cpp_lib_hardware_interference_size 154 # error "__cpp_lib_hardware_interference_size should be defined in c++23" 155 # endif 156 # if __cpp_lib_hardware_interference_size != 201703L 157 # error "__cpp_lib_hardware_interference_size should have the value 201703L in c++23" 158 # endif 159 # else 160 # ifdef __cpp_lib_hardware_interference_size 161 # error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!" 162 # endif 163 # endif 164 165 # ifndef __cpp_lib_launder 166 # error "__cpp_lib_launder should be defined in c++23" 167 # endif 168 # if __cpp_lib_launder != 201606L 169 # error "__cpp_lib_launder should have the value 201606L in c++23" 170 # endif 171 172 #elif TEST_STD_VER > 23 173 174 # if !defined(_LIBCPP_ABI_VCRUNTIME) 175 # ifndef __cpp_lib_constexpr_new 176 # error "__cpp_lib_constexpr_new should be defined in c++26" 177 # endif 178 # if __cpp_lib_constexpr_new != 202406L 179 # error "__cpp_lib_constexpr_new should have the value 202406L in c++26" 180 # endif 181 # else 182 # ifdef __cpp_lib_constexpr_new 183 # error "__cpp_lib_constexpr_new should not be defined when the requirement '!defined(_LIBCPP_ABI_VCRUNTIME)' is not met!" 184 # endif 185 # endif 186 187 # if TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L 188 # ifndef __cpp_lib_destroying_delete 189 # error "__cpp_lib_destroying_delete should be defined in c++26" 190 # endif 191 # if __cpp_lib_destroying_delete != 201806L 192 # error "__cpp_lib_destroying_delete should have the value 201806L in c++26" 193 # endif 194 # else 195 # ifdef __cpp_lib_destroying_delete 196 # error "__cpp_lib_destroying_delete should not be defined when the requirement 'TEST_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L' is not met!" 197 # endif 198 # endif 199 200 # if !defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE)) 201 # ifndef __cpp_lib_hardware_interference_size 202 # error "__cpp_lib_hardware_interference_size should be defined in c++26" 203 # endif 204 # if __cpp_lib_hardware_interference_size != 201703L 205 # error "__cpp_lib_hardware_interference_size should have the value 201703L in c++26" 206 # endif 207 # else 208 # ifdef __cpp_lib_hardware_interference_size 209 # error "__cpp_lib_hardware_interference_size should not be defined when the requirement '!defined(_LIBCPP_VERSION) || (defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE))' is not met!" 210 # endif 211 # endif 212 213 # ifndef __cpp_lib_launder 214 # error "__cpp_lib_launder should be defined in c++26" 215 # endif 216 # if __cpp_lib_launder != 201606L 217 # error "__cpp_lib_launder should have the value 201606L in c++26" 218 # endif 219 220 #endif // TEST_STD_VER > 23 221 222