516 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// WARNING: This test was generated by generate_feature_test_macro_components.py10// and should not be edited manually.11 12// <string>13 14// Test the feature test macros defined by <string>15 16// clang-format off17 18#include <string>19#include "test_macros.h"20 21#if TEST_STD_VER < 1422 23# ifdef __cpp_lib_allocator_traits_is_always_equal24# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"25# endif26 27# ifdef __cpp_lib_char8_t28# error "__cpp_lib_char8_t should not be defined before c++20"29# endif30 31# ifdef __cpp_lib_constexpr_string32# error "__cpp_lib_constexpr_string should not be defined before c++20"33# endif34 35# ifdef __cpp_lib_containers_ranges36# error "__cpp_lib_containers_ranges should not be defined before c++23"37# endif38 39# ifdef __cpp_lib_default_template_type_for_algorithm_values40# error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"41# endif42 43# ifdef __cpp_lib_erase_if44# error "__cpp_lib_erase_if should not be defined before c++20"45# endif46 47# ifdef __cpp_lib_nonmember_container_access48# error "__cpp_lib_nonmember_container_access should not be defined before c++17"49# endif50 51# ifdef __cpp_lib_starts_ends_with52# error "__cpp_lib_starts_ends_with should not be defined before c++20"53# endif54 55# ifdef __cpp_lib_string_contains56# error "__cpp_lib_string_contains should not be defined before c++23"57# endif58 59# ifdef __cpp_lib_string_resize_and_overwrite60# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"61# endif62 63# ifdef __cpp_lib_string_subview64# error "__cpp_lib_string_subview should not be defined before c++26"65# endif66 67# ifdef __cpp_lib_string_udls68# error "__cpp_lib_string_udls should not be defined before c++14"69# endif70 71# ifdef __cpp_lib_string_view72# error "__cpp_lib_string_view should not be defined before c++17"73# endif74 75# ifdef __cpp_lib_to_string76# error "__cpp_lib_to_string should not be defined before c++26"77# endif78 79#elif TEST_STD_VER == 1480 81# ifdef __cpp_lib_allocator_traits_is_always_equal82# error "__cpp_lib_allocator_traits_is_always_equal should not be defined before c++17"83# endif84 85# ifdef __cpp_lib_char8_t86# error "__cpp_lib_char8_t should not be defined before c++20"87# endif88 89# ifdef __cpp_lib_constexpr_string90# error "__cpp_lib_constexpr_string should not be defined before c++20"91# endif92 93# ifdef __cpp_lib_containers_ranges94# error "__cpp_lib_containers_ranges should not be defined before c++23"95# endif96 97# ifdef __cpp_lib_default_template_type_for_algorithm_values98# error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"99# endif100 101# ifdef __cpp_lib_erase_if102# error "__cpp_lib_erase_if should not be defined before c++20"103# endif104 105# ifdef __cpp_lib_nonmember_container_access106# error "__cpp_lib_nonmember_container_access should not be defined before c++17"107# endif108 109# ifdef __cpp_lib_starts_ends_with110# error "__cpp_lib_starts_ends_with should not be defined before c++20"111# endif112 113# ifdef __cpp_lib_string_contains114# error "__cpp_lib_string_contains should not be defined before c++23"115# endif116 117# ifdef __cpp_lib_string_resize_and_overwrite118# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"119# endif120 121# ifdef __cpp_lib_string_subview122# error "__cpp_lib_string_subview should not be defined before c++26"123# endif124 125# ifndef __cpp_lib_string_udls126# error "__cpp_lib_string_udls should be defined in c++14"127# endif128# if __cpp_lib_string_udls != 201304L129# error "__cpp_lib_string_udls should have the value 201304L in c++14"130# endif131 132# ifdef __cpp_lib_string_view133# error "__cpp_lib_string_view should not be defined before c++17"134# endif135 136# ifdef __cpp_lib_to_string137# error "__cpp_lib_to_string should not be defined before c++26"138# endif139 140#elif TEST_STD_VER == 17141 142# ifndef __cpp_lib_allocator_traits_is_always_equal143# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++17"144# endif145# if __cpp_lib_allocator_traits_is_always_equal != 201411L146# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++17"147# endif148 149# ifdef __cpp_lib_char8_t150# error "__cpp_lib_char8_t should not be defined before c++20"151# endif152 153# ifdef __cpp_lib_constexpr_string154# error "__cpp_lib_constexpr_string should not be defined before c++20"155# endif156 157# ifdef __cpp_lib_containers_ranges158# error "__cpp_lib_containers_ranges should not be defined before c++23"159# endif160 161# ifdef __cpp_lib_default_template_type_for_algorithm_values162# error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"163# endif164 165# ifdef __cpp_lib_erase_if166# error "__cpp_lib_erase_if should not be defined before c++20"167# endif168 169# ifndef __cpp_lib_nonmember_container_access170# error "__cpp_lib_nonmember_container_access should be defined in c++17"171# endif172# if __cpp_lib_nonmember_container_access != 201411L173# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++17"174# endif175 176# ifdef __cpp_lib_starts_ends_with177# error "__cpp_lib_starts_ends_with should not be defined before c++20"178# endif179 180# ifdef __cpp_lib_string_contains181# error "__cpp_lib_string_contains should not be defined before c++23"182# endif183 184# ifdef __cpp_lib_string_resize_and_overwrite185# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"186# endif187 188# ifdef __cpp_lib_string_subview189# error "__cpp_lib_string_subview should not be defined before c++26"190# endif191 192# ifndef __cpp_lib_string_udls193# error "__cpp_lib_string_udls should be defined in c++17"194# endif195# if __cpp_lib_string_udls != 201304L196# error "__cpp_lib_string_udls should have the value 201304L in c++17"197# endif198 199# ifndef __cpp_lib_string_view200# error "__cpp_lib_string_view should be defined in c++17"201# endif202# if __cpp_lib_string_view != 201606L203# error "__cpp_lib_string_view should have the value 201606L in c++17"204# endif205 206# ifdef __cpp_lib_to_string207# error "__cpp_lib_to_string should not be defined before c++26"208# endif209 210#elif TEST_STD_VER == 20211 212# ifndef __cpp_lib_allocator_traits_is_always_equal213# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++20"214# endif215# if __cpp_lib_allocator_traits_is_always_equal != 201411L216# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++20"217# endif218 219# if defined(__cpp_char8_t)220# ifndef __cpp_lib_char8_t221# error "__cpp_lib_char8_t should be defined in c++20"222# endif223# if __cpp_lib_char8_t != 201907L224# error "__cpp_lib_char8_t should have the value 201907L in c++20"225# endif226# else227# ifdef __cpp_lib_char8_t228# error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"229# endif230# endif231 232# ifndef __cpp_lib_constexpr_string233# error "__cpp_lib_constexpr_string should be defined in c++20"234# endif235# if __cpp_lib_constexpr_string != 201907L236# error "__cpp_lib_constexpr_string should have the value 201907L in c++20"237# endif238 239# ifdef __cpp_lib_containers_ranges240# error "__cpp_lib_containers_ranges should not be defined before c++23"241# endif242 243# ifdef __cpp_lib_default_template_type_for_algorithm_values244# error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"245# endif246 247# ifndef __cpp_lib_erase_if248# error "__cpp_lib_erase_if should be defined in c++20"249# endif250# if __cpp_lib_erase_if != 202002L251# error "__cpp_lib_erase_if should have the value 202002L in c++20"252# endif253 254# ifndef __cpp_lib_nonmember_container_access255# error "__cpp_lib_nonmember_container_access should be defined in c++20"256# endif257# if __cpp_lib_nonmember_container_access != 201411L258# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++20"259# endif260 261# ifndef __cpp_lib_starts_ends_with262# error "__cpp_lib_starts_ends_with should be defined in c++20"263# endif264# if __cpp_lib_starts_ends_with != 201711L265# error "__cpp_lib_starts_ends_with should have the value 201711L in c++20"266# endif267 268# ifdef __cpp_lib_string_contains269# error "__cpp_lib_string_contains should not be defined before c++23"270# endif271 272# ifdef __cpp_lib_string_resize_and_overwrite273# error "__cpp_lib_string_resize_and_overwrite should not be defined before c++23"274# endif275 276# ifdef __cpp_lib_string_subview277# error "__cpp_lib_string_subview should not be defined before c++26"278# endif279 280# ifndef __cpp_lib_string_udls281# error "__cpp_lib_string_udls should be defined in c++20"282# endif283# if __cpp_lib_string_udls != 201304L284# error "__cpp_lib_string_udls should have the value 201304L in c++20"285# endif286 287# ifndef __cpp_lib_string_view288# error "__cpp_lib_string_view should be defined in c++20"289# endif290# if __cpp_lib_string_view != 201803L291# error "__cpp_lib_string_view should have the value 201803L in c++20"292# endif293 294# ifdef __cpp_lib_to_string295# error "__cpp_lib_to_string should not be defined before c++26"296# endif297 298#elif TEST_STD_VER == 23299 300# ifndef __cpp_lib_allocator_traits_is_always_equal301# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++23"302# endif303# if __cpp_lib_allocator_traits_is_always_equal != 201411L304# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++23"305# endif306 307# if defined(__cpp_char8_t)308# ifndef __cpp_lib_char8_t309# error "__cpp_lib_char8_t should be defined in c++23"310# endif311# if __cpp_lib_char8_t != 201907L312# error "__cpp_lib_char8_t should have the value 201907L in c++23"313# endif314# else315# ifdef __cpp_lib_char8_t316# error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"317# endif318# endif319 320# ifndef __cpp_lib_constexpr_string321# error "__cpp_lib_constexpr_string should be defined in c++23"322# endif323# if __cpp_lib_constexpr_string != 201907L324# error "__cpp_lib_constexpr_string should have the value 201907L in c++23"325# endif326 327# ifndef __cpp_lib_containers_ranges328# error "__cpp_lib_containers_ranges should be defined in c++23"329# endif330# if __cpp_lib_containers_ranges != 202202L331# error "__cpp_lib_containers_ranges should have the value 202202L in c++23"332# endif333 334# ifdef __cpp_lib_default_template_type_for_algorithm_values335# error "__cpp_lib_default_template_type_for_algorithm_values should not be defined before c++26"336# endif337 338# ifndef __cpp_lib_erase_if339# error "__cpp_lib_erase_if should be defined in c++23"340# endif341# if __cpp_lib_erase_if != 202002L342# error "__cpp_lib_erase_if should have the value 202002L in c++23"343# endif344 345# ifndef __cpp_lib_nonmember_container_access346# error "__cpp_lib_nonmember_container_access should be defined in c++23"347# endif348# if __cpp_lib_nonmember_container_access != 201411L349# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++23"350# endif351 352# ifndef __cpp_lib_starts_ends_with353# error "__cpp_lib_starts_ends_with should be defined in c++23"354# endif355# if __cpp_lib_starts_ends_with != 201711L356# error "__cpp_lib_starts_ends_with should have the value 201711L in c++23"357# endif358 359# ifndef __cpp_lib_string_contains360# error "__cpp_lib_string_contains should be defined in c++23"361# endif362# if __cpp_lib_string_contains != 202011L363# error "__cpp_lib_string_contains should have the value 202011L in c++23"364# endif365 366# ifndef __cpp_lib_string_resize_and_overwrite367# error "__cpp_lib_string_resize_and_overwrite should be defined in c++23"368# endif369# if __cpp_lib_string_resize_and_overwrite != 202110L370# error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++23"371# endif372 373# ifdef __cpp_lib_string_subview374# error "__cpp_lib_string_subview should not be defined before c++26"375# endif376 377# ifndef __cpp_lib_string_udls378# error "__cpp_lib_string_udls should be defined in c++23"379# endif380# if __cpp_lib_string_udls != 201304L381# error "__cpp_lib_string_udls should have the value 201304L in c++23"382# endif383 384# ifndef __cpp_lib_string_view385# error "__cpp_lib_string_view should be defined in c++23"386# endif387# if __cpp_lib_string_view != 201803L388# error "__cpp_lib_string_view should have the value 201803L in c++23"389# endif390 391# ifdef __cpp_lib_to_string392# error "__cpp_lib_to_string should not be defined before c++26"393# endif394 395#elif TEST_STD_VER > 23396 397# ifndef __cpp_lib_allocator_traits_is_always_equal398# error "__cpp_lib_allocator_traits_is_always_equal should be defined in c++26"399# endif400# if __cpp_lib_allocator_traits_is_always_equal != 201411L401# error "__cpp_lib_allocator_traits_is_always_equal should have the value 201411L in c++26"402# endif403 404# if defined(__cpp_char8_t)405# ifndef __cpp_lib_char8_t406# error "__cpp_lib_char8_t should be defined in c++26"407# endif408# if __cpp_lib_char8_t != 201907L409# error "__cpp_lib_char8_t should have the value 201907L in c++26"410# endif411# else412# ifdef __cpp_lib_char8_t413# error "__cpp_lib_char8_t should not be defined when the requirement 'defined(__cpp_char8_t)' is not met!"414# endif415# endif416 417# ifndef __cpp_lib_constexpr_string418# error "__cpp_lib_constexpr_string should be defined in c++26"419# endif420# if __cpp_lib_constexpr_string != 201907L421# error "__cpp_lib_constexpr_string should have the value 201907L in c++26"422# endif423 424# ifndef __cpp_lib_containers_ranges425# error "__cpp_lib_containers_ranges should be defined in c++26"426# endif427# if __cpp_lib_containers_ranges != 202202L428# error "__cpp_lib_containers_ranges should have the value 202202L in c++26"429# endif430 431# if !defined(_LIBCPP_VERSION)432# ifndef __cpp_lib_default_template_type_for_algorithm_values433# error "__cpp_lib_default_template_type_for_algorithm_values should be defined in c++26"434# endif435# if __cpp_lib_default_template_type_for_algorithm_values != 202403L436# error "__cpp_lib_default_template_type_for_algorithm_values should have the value 202403L in c++26"437# endif438# else439# ifdef __cpp_lib_default_template_type_for_algorithm_values440# error "__cpp_lib_default_template_type_for_algorithm_values should not be defined because it is unimplemented in libc++!"441# endif442# endif443 444# ifndef __cpp_lib_erase_if445# error "__cpp_lib_erase_if should be defined in c++26"446# endif447# if __cpp_lib_erase_if != 202002L448# error "__cpp_lib_erase_if should have the value 202002L in c++26"449# endif450 451# ifndef __cpp_lib_nonmember_container_access452# error "__cpp_lib_nonmember_container_access should be defined in c++26"453# endif454# if __cpp_lib_nonmember_container_access != 201411L455# error "__cpp_lib_nonmember_container_access should have the value 201411L in c++26"456# endif457 458# ifndef __cpp_lib_starts_ends_with459# error "__cpp_lib_starts_ends_with should be defined in c++26"460# endif461# if __cpp_lib_starts_ends_with != 201711L462# error "__cpp_lib_starts_ends_with should have the value 201711L in c++26"463# endif464 465# ifndef __cpp_lib_string_contains466# error "__cpp_lib_string_contains should be defined in c++26"467# endif468# if __cpp_lib_string_contains != 202011L469# error "__cpp_lib_string_contains should have the value 202011L in c++26"470# endif471 472# ifndef __cpp_lib_string_resize_and_overwrite473# error "__cpp_lib_string_resize_and_overwrite should be defined in c++26"474# endif475# if __cpp_lib_string_resize_and_overwrite != 202110L476# error "__cpp_lib_string_resize_and_overwrite should have the value 202110L in c++26"477# endif478 479# ifndef __cpp_lib_string_subview480# error "__cpp_lib_string_subview should be defined in c++26"481# endif482# if __cpp_lib_string_subview != 202506L483# error "__cpp_lib_string_subview should have the value 202506L in c++26"484# endif485 486# ifndef __cpp_lib_string_udls487# error "__cpp_lib_string_udls should be defined in c++26"488# endif489# if __cpp_lib_string_udls != 201304L490# error "__cpp_lib_string_udls should have the value 201304L in c++26"491# endif492 493# ifndef __cpp_lib_string_view494# error "__cpp_lib_string_view should be defined in c++26"495# endif496# if __cpp_lib_string_view != 202403L497# error "__cpp_lib_string_view should have the value 202403L in c++26"498# endif499 500# if !defined(_LIBCPP_VERSION)501# ifndef __cpp_lib_to_string502# error "__cpp_lib_to_string should be defined in c++26"503# endif504# if __cpp_lib_to_string != 202306L505# error "__cpp_lib_to_string should have the value 202306L in c++26"506# endif507# else508# ifdef __cpp_lib_to_string509# error "__cpp_lib_to_string should not be defined because it is unimplemented in libc++!"510# endif511# endif512 513#endif // TEST_STD_VER > 23514 515// clang-format on516