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