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 // <string> 15 16 // Test the feature test macros defined by <string> 17 18 /* Constant Value 19 __cpp_lib_allocator_traits_is_always_equal 201411L [C++17] 20 __cpp_lib_char8_t 201907L [C++20] 21 __cpp_lib_constexpr_string 201907L [C++20] 22 __cpp_lib_erase_if 202002L [C++20] 23 __cpp_lib_nonmember_container_access 201411L [C++17] 24 __cpp_lib_ranges_to_container 202202L [C++23] 25 __cpp_lib_starts_ends_with 201711L [C++20] 26 __cpp_lib_string_contains 202011L [C++23] 27 __cpp_lib_string_resize_and_overwrite 202110L [C++23] 28 __cpp_lib_string_udls 201304L [C++14] 29 __cpp_lib_string_view 201606L [C++17] 30 201803L [C++20] 31 __cpp_lib_to_string 202306L [C++23] 32 */ 33 34 #include <string> 35 #include "test_macros.h" 36 37 #if TEST_STD_VER < 14 38 39 # ifdef __cpp_lib_allocator_traits_is_always_equal 40 # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" 41 # endif 42 43 # ifdef __cpp_lib_char8_t 44 # error "__cpp_lib_char8_t should not be defined before c++20" 45 # endif 46 47 # ifdef __cpp_lib_constexpr_string 48 # error "__cpp_lib_constexpr_string should not be defined before c++20" 49 # endif 50 51 # ifdef __cpp_lib_erase_if 52 # error "__cpp_lib_erase_if should not be defined before c++20" 53 # endif 54 55 # ifdef __cpp_lib_nonmember_container_access 56 # error "__cpp_lib_nonmember_container_access should not be defined before c++17" 57 # endif 58 59 # ifdef __cpp_lib_ranges_to_container 60 # error "__cpp_lib_ranges_to_container should not be defined before c++23" 61 # endif 62 63 # ifdef __cpp_lib_starts_ends_with 64 # error "__cpp_lib_starts_ends_with should not be defined before c++20" 65 # endif 66 67 # ifdef __cpp_lib_string_contains 68 # error "__cpp_lib_string_contains should not be defined before c++23" 69 # endif 70 71 # ifdef __cpp_lib_string_resize_and_overwrite 72 # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" 73 # endif 74 75 # ifdef __cpp_lib_string_udls 76 # error "__cpp_lib_string_udls should not be defined before c++14" 77 # endif 78 79 # ifdef __cpp_lib_string_view 80 # error "__cpp_lib_string_view should not be defined before c++17" 81 # endif 82 83 # ifdef __cpp_lib_to_string 84 # error "__cpp_lib_to_string should not be defined before c++23" 85 # endif 86 87 #elif TEST_STD_VER == 14 88 89 # ifdef __cpp_lib_allocator_traits_is_always_equal 90 # error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17" 91 # endif 92 93 # ifdef __cpp_lib_char8_t 94 # error "__cpp_lib_char8_t should not be defined before c++20" 95 # endif 96 97 # ifdef __cpp_lib_constexpr_string 98 # error "__cpp_lib_constexpr_string should not be defined before c++20" 99 # endif 100 101 # ifdef __cpp_lib_erase_if 102 # error "__cpp_lib_erase_if should not be defined before c++20" 103 # endif 104 105 # ifdef __cpp_lib_nonmember_container_access 106 # error "__cpp_lib_nonmember_container_access should not be defined before c++17" 107 # endif 108 109 # ifdef __cpp_lib_ranges_to_container 110 # error "__cpp_lib_ranges_to_container should not be defined before c++23" 111 # endif 112 113 # ifdef __cpp_lib_starts_ends_with 114 # error "__cpp_lib_starts_ends_with should not be defined before c++20" 115 # endif 116 117 # ifdef __cpp_lib_string_contains 118 # error "__cpp_lib_string_contains should not be defined before c++23" 119 # endif 120 121 # ifdef __cpp_lib_string_resize_and_overwrite 122 # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" 123 # endif 124 125 # ifndef __cpp_lib_string_udls 126 # error "__cpp_lib_string_udls should be defined in c++14" 127 # endif 128 # if __cpp_lib_string_udls != 201304L 129 # error "__cpp_lib_string_udls should have the value 201304L in c++14" 130 # endif 131 132 # ifdef __cpp_lib_string_view 133 # error "__cpp_lib_string_view should not be defined before c++17" 134 # endif 135 136 # ifdef __cpp_lib_to_string 137 # error "__cpp_lib_to_string should not be defined before c++23" 138 # endif 139 140 #elif TEST_STD_VER == 17 141 142 # ifndef __cpp_lib_allocator_traits_is_always_equal 143 # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17" 144 # endif 145 # if __cpp_lib_allocator_traits_is_always_equal != 201411L 146 # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17" 147 # endif 148 149 # ifdef __cpp_lib_char8_t 150 # error "__cpp_lib_char8_t should not be defined before c++20" 151 # endif 152 153 # ifdef __cpp_lib_constexpr_string 154 # error "__cpp_lib_constexpr_string should not be defined before c++20" 155 # endif 156 157 # ifdef __cpp_lib_erase_if 158 # error "__cpp_lib_erase_if should not be defined before c++20" 159 # endif 160 161 # ifndef __cpp_lib_nonmember_container_access 162 # error "__cpp_lib_nonmember_container_access should be defined in c++17" 163 # endif 164 # if __cpp_lib_nonmember_container_access != 201411L 165 # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17" 166 # endif 167 168 # ifdef __cpp_lib_ranges_to_container 169 # error "__cpp_lib_ranges_to_container should not be defined before c++23" 170 # endif 171 172 # ifdef __cpp_lib_starts_ends_with 173 # error "__cpp_lib_starts_ends_with should not be defined before c++20" 174 # endif 175 176 # ifdef __cpp_lib_string_contains 177 # error "__cpp_lib_string_contains should not be defined before c++23" 178 # endif 179 180 # ifdef __cpp_lib_string_resize_and_overwrite 181 # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" 182 # endif 183 184 # ifndef __cpp_lib_string_udls 185 # error "__cpp_lib_string_udls should be defined in c++17" 186 # endif 187 # if __cpp_lib_string_udls != 201304L 188 # error "__cpp_lib_string_udls should have the value 201304L in c++17" 189 # endif 190 191 # ifndef __cpp_lib_string_view 192 # error "__cpp_lib_string_view should be defined in c++17" 193 # endif 194 # if __cpp_lib_string_view != 201606L 195 # error "__cpp_lib_string_view should have the value 201606L in c++17" 196 # endif 197 198 # ifdef __cpp_lib_to_string 199 # error "__cpp_lib_to_string should not be defined before c++23" 200 # endif 201 202 #elif TEST_STD_VER == 20 203 204 # ifndef __cpp_lib_allocator_traits_is_always_equal 205 # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++20" 206 # endif 207 # if __cpp_lib_allocator_traits_is_always_equal != 201411L 208 # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20" 209 # endif 210 211 # if defined(__cpp_char8_t) 212 # ifndef __cpp_lib_char8_t 213 # error "__cpp_lib_char8_t should be defined in c++20" 214 # endif 215 # if __cpp_lib_char8_t != 201907L 216 # error "__cpp_lib_char8_t should have the value 201907L in c++20" 217 # endif 218 # else 219 # ifdef __cpp_lib_char8_t 220 # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" 221 # endif 222 # endif 223 224 # ifndef __cpp_lib_constexpr_string 225 # error "__cpp_lib_constexpr_string should be defined in c++20" 226 # endif 227 # if __cpp_lib_constexpr_string != 201907L 228 # error "__cpp_lib_constexpr_string should have the value 201907L in c++20" 229 # endif 230 231 # ifndef __cpp_lib_erase_if 232 # error "__cpp_lib_erase_if should be defined in c++20" 233 # endif 234 # if __cpp_lib_erase_if != 202002L 235 # error "__cpp_lib_erase_if should have the value 202002L in c++20" 236 # endif 237 238 # ifndef __cpp_lib_nonmember_container_access 239 # error "__cpp_lib_nonmember_container_access should be defined in c++20" 240 # endif 241 # if __cpp_lib_nonmember_container_access != 201411L 242 # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20" 243 # endif 244 245 # ifdef __cpp_lib_ranges_to_container 246 # error "__cpp_lib_ranges_to_container should not be defined before c++23" 247 # endif 248 249 # ifndef __cpp_lib_starts_ends_with 250 # error "__cpp_lib_starts_ends_with should be defined in c++20" 251 # endif 252 # if __cpp_lib_starts_ends_with != 201711L 253 # error "__cpp_lib_starts_ends_with should have the value 201711L in c++20" 254 # endif 255 256 # ifdef __cpp_lib_string_contains 257 # error "__cpp_lib_string_contains should not be defined before c++23" 258 # endif 259 260 # ifdef __cpp_lib_string_resize_and_overwrite 261 # error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23" 262 # endif 263 264 # ifndef __cpp_lib_string_udls 265 # error "__cpp_lib_string_udls should be defined in c++20" 266 # endif 267 # if __cpp_lib_string_udls != 201304L 268 # error "__cpp_lib_string_udls should have the value 201304L in c++20" 269 # endif 270 271 # ifndef __cpp_lib_string_view 272 # error "__cpp_lib_string_view should be defined in c++20" 273 # endif 274 # if __cpp_lib_string_view != 201803L 275 # error "__cpp_lib_string_view should have the value 201803L in c++20" 276 # endif 277 278 # ifdef __cpp_lib_to_string 279 # error "__cpp_lib_to_string should not be defined before c++23" 280 # endif 281 282 #elif TEST_STD_VER == 23 283 284 # ifndef __cpp_lib_allocator_traits_is_always_equal 285 # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++23" 286 # endif 287 # if __cpp_lib_allocator_traits_is_always_equal != 201411L 288 # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23" 289 # endif 290 291 # if defined(__cpp_char8_t) 292 # ifndef __cpp_lib_char8_t 293 # error "__cpp_lib_char8_t should be defined in c++23" 294 # endif 295 # if __cpp_lib_char8_t != 201907L 296 # error "__cpp_lib_char8_t should have the value 201907L in c++23" 297 # endif 298 # else 299 # ifdef __cpp_lib_char8_t 300 # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" 301 # endif 302 # endif 303 304 # ifndef __cpp_lib_constexpr_string 305 # error "__cpp_lib_constexpr_string should be defined in c++23" 306 # endif 307 # if __cpp_lib_constexpr_string != 201907L 308 # error "__cpp_lib_constexpr_string should have the value 201907L in c++23" 309 # endif 310 311 # ifndef __cpp_lib_erase_if 312 # error "__cpp_lib_erase_if should be defined in c++23" 313 # endif 314 # if __cpp_lib_erase_if != 202002L 315 # error "__cpp_lib_erase_if should have the value 202002L in c++23" 316 # endif 317 318 # ifndef __cpp_lib_nonmember_container_access 319 # error "__cpp_lib_nonmember_container_access should be defined in c++23" 320 # endif 321 # if __cpp_lib_nonmember_container_access != 201411L 322 # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23" 323 # endif 324 325 # if !defined(_LIBCPP_VERSION) 326 # ifndef __cpp_lib_ranges_to_container 327 # error "__cpp_lib_ranges_to_container should be defined in c++23" 328 # endif 329 # if __cpp_lib_ranges_to_container != 202202L 330 # error "__cpp_lib_ranges_to_container should have the value 202202L in c++23" 331 # endif 332 # else // _LIBCPP_VERSION 333 # ifdef __cpp_lib_ranges_to_container 334 # error "__cpp_lib_ranges_to_container should not be defined because it is unimplemented in libc++!" 335 # endif 336 # endif 337 338 # ifndef __cpp_lib_starts_ends_with 339 # error "__cpp_lib_starts_ends_with should be defined in c++23" 340 # endif 341 # if __cpp_lib_starts_ends_with != 201711L 342 # error "__cpp_lib_starts_ends_with should have the value 201711L in c++23" 343 # endif 344 345 # ifndef __cpp_lib_string_contains 346 # error "__cpp_lib_string_contains should be defined in c++23" 347 # endif 348 # if __cpp_lib_string_contains != 202011L 349 # error "__cpp_lib_string_contains should have the value 202011L in c++23" 350 # endif 351 352 # ifndef __cpp_lib_string_resize_and_overwrite 353 # error "__cpp_lib_string_resize_and_overwrite should be defined in c++23" 354 # endif 355 # if __cpp_lib_string_resize_and_overwrite != 202110L 356 # error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++23" 357 # endif 358 359 # ifndef __cpp_lib_string_udls 360 # error "__cpp_lib_string_udls should be defined in c++23" 361 # endif 362 # if __cpp_lib_string_udls != 201304L 363 # error "__cpp_lib_string_udls should have the value 201304L in c++23" 364 # endif 365 366 # ifndef __cpp_lib_string_view 367 # error "__cpp_lib_string_view should be defined in c++23" 368 # endif 369 # if __cpp_lib_string_view != 201803L 370 # error "__cpp_lib_string_view should have the value 201803L in c++23" 371 # endif 372 373 # if !defined(_LIBCPP_VERSION) 374 # ifndef __cpp_lib_to_string 375 # error "__cpp_lib_to_string should be defined in c++23" 376 # endif 377 # if __cpp_lib_to_string != 202306L 378 # error "__cpp_lib_to_string should have the value 202306L in c++23" 379 # endif 380 # else // _LIBCPP_VERSION 381 # ifdef __cpp_lib_to_string 382 # error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!" 383 # endif 384 # endif 385 386 #elif TEST_STD_VER > 23 387 388 # ifndef __cpp_lib_allocator_traits_is_always_equal 389 # error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26" 390 # endif 391 # if __cpp_lib_allocator_traits_is_always_equal != 201411L 392 # error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26" 393 # endif 394 395 # if defined(__cpp_char8_t) 396 # ifndef __cpp_lib_char8_t 397 # error "__cpp_lib_char8_t should be defined in c++26" 398 # endif 399 # if __cpp_lib_char8_t != 201907L 400 # error "__cpp_lib_char8_t should have the value 201907L in c++26" 401 # endif 402 # else 403 # ifdef __cpp_lib_char8_t 404 # error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!" 405 # endif 406 # endif 407 408 # ifndef __cpp_lib_constexpr_string 409 # error "__cpp_lib_constexpr_string should be defined in c++26" 410 # endif 411 # if __cpp_lib_constexpr_string != 201907L 412 # error "__cpp_lib_constexpr_string should have the value 201907L in c++26" 413 # endif 414 415 # ifndef __cpp_lib_erase_if 416 # error "__cpp_lib_erase_if should be defined in c++26" 417 # endif 418 # if __cpp_lib_erase_if != 202002L 419 # error "__cpp_lib_erase_if should have the value 202002L in c++26" 420 # endif 421 422 # ifndef __cpp_lib_nonmember_container_access 423 # error "__cpp_lib_nonmember_container_access should be defined in c++26" 424 # endif 425 # if __cpp_lib_nonmember_container_access != 201411L 426 # error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26" 427 # endif 428 429 # if !defined(_LIBCPP_VERSION) 430 # ifndef __cpp_lib_ranges_to_container 431 # error "__cpp_lib_ranges_to_container should be defined in c++26" 432 # endif 433 # if __cpp_lib_ranges_to_container != 202202L 434 # error "__cpp_lib_ranges_to_container should have the value 202202L in c++26" 435 # endif 436 # else // _LIBCPP_VERSION 437 # ifdef __cpp_lib_ranges_to_container 438 # error "__cpp_lib_ranges_to_container should not be defined because it is unimplemented in libc++!" 439 # endif 440 # endif 441 442 # ifndef __cpp_lib_starts_ends_with 443 # error "__cpp_lib_starts_ends_with should be defined in c++26" 444 # endif 445 # if __cpp_lib_starts_ends_with != 201711L 446 # error "__cpp_lib_starts_ends_with should have the value 201711L in c++26" 447 # endif 448 449 # ifndef __cpp_lib_string_contains 450 # error "__cpp_lib_string_contains should be defined in c++26" 451 # endif 452 # if __cpp_lib_string_contains != 202011L 453 # error "__cpp_lib_string_contains should have the value 202011L in c++26" 454 # endif 455 456 # ifndef __cpp_lib_string_resize_and_overwrite 457 # error "__cpp_lib_string_resize_and_overwrite should be defined in c++26" 458 # endif 459 # if __cpp_lib_string_resize_and_overwrite != 202110L 460 # error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++26" 461 # endif 462 463 # ifndef __cpp_lib_string_udls 464 # error "__cpp_lib_string_udls should be defined in c++26" 465 # endif 466 # if __cpp_lib_string_udls != 201304L 467 # error "__cpp_lib_string_udls should have the value 201304L in c++26" 468 # endif 469 470 # ifndef __cpp_lib_string_view 471 # error "__cpp_lib_string_view should be defined in c++26" 472 # endif 473 # if __cpp_lib_string_view != 201803L 474 # error "__cpp_lib_string_view should have the value 201803L in c++26" 475 # endif 476 477 # if !defined(_LIBCPP_VERSION) 478 # ifndef __cpp_lib_to_string 479 # error "__cpp_lib_to_string should be defined in c++26" 480 # endif 481 # if __cpp_lib_to_string != 202306L 482 # error "__cpp_lib_to_string should have the value 202306L in c++26" 483 # endif 484 # else // _LIBCPP_VERSION 485 # ifdef __cpp_lib_to_string 486 # error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!" 487 # endif 488 # endif 489 490 #endif // TEST_STD_VER > 23 491 492