diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index 05b08da521535..db24b65caca6c 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -264,6 +264,8 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_move_iterator_concept`` ``202207L`` ---------------------------------------------------------- ----------------- + ``__cpp_lib_optional`` ``202106L`` + ---------------------------------------------------------- ----------------- ``__cpp_lib_polymorphic_allocator`` ``201902L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_ranges`` ``202110L`` @@ -300,6 +302,8 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_unwrap_ref`` ``201811L`` ---------------------------------------------------------- ----------------- + ``__cpp_lib_variant`` ``202106L`` + ---------------------------------------------------------- ----------------- **C++23** ---------------------------------------------------------------------------- ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L`` @@ -491,5 +495,7 @@ Status ``__cpp_lib_to_string`` *unimplemented* ---------------------------------------------------------- ----------------- ``__cpp_lib_tuple_like`` *unimplemented* + ---------------------------------------------------------- ----------------- + ``__cpp_lib_variant`` ``202306L`` ========================================================== ================= diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv index cc75d28f14aac..9a057be8ad051 100644 --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -192,7 +192,7 @@ "`P2106R0 `__","Alternative wording for GB315 and GB316","2020-02 (Prague)","|Complete|","15.0","" "`P2116R0 `__","Remove tuple-like protocol support from fixed-extent span","2020-02 (Prague)","|Complete|","11.0","" "","","","","","" -"`P2231R1 `__","Missing constexpr in std::optional and std::variant","2021-06 (Virtual)","|Complete|","19.0","" +"`P2231R1 `__","Missing constexpr in std::optional and std::variant","2021-06 (Virtual)","|Complete|","19.0","Changes of feature-test macros are completed in LLVM 20." "`P2325R3 `__","Views should not be required to be default constructible","2021-06 (Virtual)","|Complete|","16.0","" "`P2210R2 `__","Superior String Splitting","2021-06 (Virtual)","|Complete|","16.0","" "`P2216R3 `__","std::format improvements","2021-06 (Virtual)","|Complete|","15.0","" diff --git a/libcxx/docs/Status/Cxx2cPapers.csv b/libcxx/docs/Status/Cxx2cPapers.csv index 8864b1ebe2889..d5d5cdda065ae 100644 --- a/libcxx/docs/Status/Cxx2cPapers.csv +++ b/libcxx/docs/Status/Cxx2cPapers.csv @@ -17,7 +17,7 @@ "`P0792R14 `__","``function_ref``: a type-erased callable reference","2023-06 (Varna)","","","" "`P2874R2 `__","Mandating Annex D Require No More","2023-06 (Varna)","","","" "`P2757R3 `__","Type-checking format args","2023-06 (Varna)","","","" -"`P2637R3 `__","Member ``visit``","2023-06 (Varna)","|Complete|","19.0","" +"`P2637R3 `__","Member ``visit``","2023-06 (Varna)","|Complete|","19.0","Change of ``__cpp_lib_variant`` is completed in LLVM 20. Change of ``__cpp_lib_format`` is blocked by `P2419R2 `__." "`P2641R4 `__","Checking if a ``union`` alternative is active","2023-06 (Varna)","","","" "`P1759R6 `__","Native handles and file streams","2023-06 (Varna)","|Complete|","18.0","" "`P2697R1 `__","Interfacing ``bitset`` with ``string_view``","2023-06 (Varna)","|Complete|","18.0","" diff --git a/libcxx/include/version b/libcxx/include/version index 5ab4f28a04d88..cb75f3b2db681 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -174,6 +174,7 @@ __cpp_lib_nonmember_container_access 201411L __cpp_lib_not_fn 201603L __cpp_lib_null_iterators 201304L __cpp_lib_optional 202110L + 202106L // C++20 201606L // C++17 __cpp_lib_optional_range_support 202406L __cpp_lib_out_ptr 202311L @@ -261,7 +262,9 @@ __cpp_lib_uncaught_exceptions 201411L __cpp_lib_unordered_map_try_emplace 201411L __cpp_lib_unreachable 202202L __cpp_lib_unwrap_ref 201811L -__cpp_lib_variant 202102L +__cpp_lib_variant 202306L + 202106L // C++20 + 202102L // C++17 __cpp_lib_void_t 201411L */ @@ -427,6 +430,8 @@ __cpp_lib_void_t 201411L # define __cpp_lib_list_remove_return_type 201806L # define __cpp_lib_math_constants 201907L # define __cpp_lib_move_iterator_concept 202207L +# undef __cpp_lib_optional +# define __cpp_lib_optional 202106L # if _LIBCPP_AVAILABILITY_HAS_PMR # define __cpp_lib_polymorphic_allocator 201902L # endif @@ -453,6 +458,8 @@ __cpp_lib_void_t 201411L # define __cpp_lib_to_array 201907L # define __cpp_lib_type_identity 201806L # define __cpp_lib_unwrap_ref 201811L +# undef __cpp_lib_variant +# define __cpp_lib_variant 202106L #endif #if _LIBCPP_STD_VER >= 23 @@ -570,6 +577,8 @@ __cpp_lib_void_t 201411L // # define __cpp_lib_to_string 202306L # undef __cpp_lib_tuple_like // # define __cpp_lib_tuple_like 202311L +# undef __cpp_lib_variant +# define __cpp_lib_variant 202306L #endif // clang-format on diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp index f265be091f79b..91abbbc77837b 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/optional.version.compile.pass.cpp @@ -19,6 +19,7 @@ __cpp_lib_constrained_equality 202403L [C++26] __cpp_lib_freestanding_optional 202311L [C++26] __cpp_lib_optional 201606L [C++17] + 202106L [C++20] 202110L [C++23] __cpp_lib_optional_range_support 202406L [C++26] */ @@ -96,8 +97,8 @@ # ifndef __cpp_lib_optional # error "__cpp_lib_optional should be defined in c++20" # endif -# if __cpp_lib_optional != 201606L -# error "__cpp_lib_optional should have the value 201606L in c++20" +# if __cpp_lib_optional != 202106L +# error "__cpp_lib_optional should have the value 202106L in c++20" # endif # ifdef __cpp_lib_optional_range_support diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp index 4dcc477696bfd..598e976bda3cf 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/variant.version.compile.pass.cpp @@ -19,6 +19,8 @@ __cpp_lib_constrained_equality 202403L [C++26] __cpp_lib_freestanding_variant 202311L [C++26] __cpp_lib_variant 202102L [C++17] + 202106L [C++20] + 202306L [C++26] */ #include @@ -82,8 +84,8 @@ # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++20" # endif -# if __cpp_lib_variant != 202102L -# error "__cpp_lib_variant should have the value 202102L in c++20" +# if __cpp_lib_variant != 202106L +# error "__cpp_lib_variant should have the value 202106L in c++20" # endif #elif TEST_STD_VER == 23 @@ -99,8 +101,8 @@ # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++23" # endif -# if __cpp_lib_variant != 202102L -# error "__cpp_lib_variant should have the value 202102L in c++23" +# if __cpp_lib_variant != 202106L +# error "__cpp_lib_variant should have the value 202106L in c++23" # endif #elif TEST_STD_VER > 23 @@ -134,8 +136,8 @@ # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++26" # endif -# if __cpp_lib_variant != 202102L -# error "__cpp_lib_variant should have the value 202102L in c++26" +# if __cpp_lib_variant != 202306L +# error "__cpp_lib_variant should have the value 202306L in c++26" # endif #endif // TEST_STD_VER > 23 diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp index 0614f64a2ef04..5deaee16895f6 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp @@ -158,6 +158,7 @@ __cpp_lib_not_fn 201603L [C++17] __cpp_lib_null_iterators 201304L [C++14] __cpp_lib_optional 201606L [C++17] + 202106L [C++20] 202110L [C++23] __cpp_lib_optional_range_support 202406L [C++26] __cpp_lib_out_ptr 202106L [C++23] @@ -244,6 +245,8 @@ __cpp_lib_unreachable 202202L [C++23] __cpp_lib_unwrap_ref 201811L [C++20] __cpp_lib_variant 202102L [C++17] + 202106L [C++20] + 202306L [C++26] __cpp_lib_void_t 201411L [C++17] */ @@ -4087,8 +4090,8 @@ # ifndef __cpp_lib_optional # error "__cpp_lib_optional should be defined in c++20" # endif -# if __cpp_lib_optional != 201606L -# error "__cpp_lib_optional should have the value 201606L in c++20" +# if __cpp_lib_optional != 202106L +# error "__cpp_lib_optional should have the value 202106L in c++20" # endif # ifdef __cpp_lib_optional_range_support @@ -4569,8 +4572,8 @@ # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++20" # endif -# if __cpp_lib_variant != 202102L -# error "__cpp_lib_variant should have the value 202102L in c++20" +# if __cpp_lib_variant != 202106L +# error "__cpp_lib_variant should have the value 202106L in c++20" # endif # ifndef __cpp_lib_void_t @@ -6196,8 +6199,8 @@ # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++23" # endif -# if __cpp_lib_variant != 202102L -# error "__cpp_lib_variant should have the value 202102L in c++23" +# if __cpp_lib_variant != 202106L +# error "__cpp_lib_variant should have the value 202106L in c++23" # endif # ifndef __cpp_lib_void_t @@ -8141,8 +8144,8 @@ # ifndef __cpp_lib_variant # error "__cpp_lib_variant should be defined in c++26" # endif -# if __cpp_lib_variant != 202102L -# error "__cpp_lib_variant should have the value 202102L in c++26" +# if __cpp_lib_variant != 202306L +# error "__cpp_lib_variant should have the value 202306L in c++26" # endif # ifndef __cpp_lib_void_t diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 7ab1af93d1774..197d6bbc69222 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -942,7 +942,11 @@ def add_version_header(tc): }, { "name": "__cpp_lib_optional", - "values": {"c++17": 201606, "c++23": 202110}, + "values": { + "c++17": 201606, + "c++20": 202106, # P2231R1 Missing constexpr in std::optional and std::variant + "c++23": 202110, # P0798R8 Monadic operations for std::optional + LWG3621 Remove feature-test macro __cpp_lib_monadic_optional + }, "headers": ["optional"], }, { @@ -1406,8 +1410,8 @@ def add_version_header(tc): "name": "__cpp_lib_variant", "values": { "c++17": 202102, # std::visit for classes derived from std::variant - # "c++20": 202106, # Fully constexpr std::variant - # "c++26": 202306, # Member visit (implemented) + "c++20": 202106, # P2231R1 Missing constexpr in std::optional and std::variant + "c++26": 202306, # P2637R3 Member visit }, "headers": ["variant"], },