Skip to content

[libc++] Bump __cpp_lib_optional and __cpp_lib_variant #113650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_move_iterator_concept`` ``202207L``
---------------------------------------------------------- -----------------
``__cpp_lib_optional`` ``202106L``
---------------------------------------------------------- -----------------
``__cpp_lib_polymorphic_allocator`` ``201902L``
---------------------------------------------------------- -----------------
``__cpp_lib_ranges`` ``202110L``
Expand Down Expand Up @@ -300,6 +302,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_unwrap_ref`` ``201811L``
---------------------------------------------------------- -----------------
``__cpp_lib_variant`` ``202106L``
---------------------------------------------------------- -----------------
**C++23**
----------------------------------------------------------------------------
``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
Expand Down Expand Up @@ -491,5 +495,7 @@ Status
``__cpp_lib_to_string`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_tuple_like`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_variant`` ``202306L``
========================================================== =================

2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx20Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
"`P2106R0 <https://wg21.link/P2106R0>`__","Alternative wording for GB315 and GB316","2020-02 (Prague)","|Complete|","15.0",""
"`P2116R0 <https://wg21.link/P2116R0>`__","Remove tuple-like protocol support from fixed-extent span","2020-02 (Prague)","|Complete|","11.0",""
"","","","","",""
"`P2231R1 <https://wg21.link/P2231R1>`__","Missing constexpr in std::optional and std::variant","2021-06 (Virtual)","|Complete|","19.0",""
"`P2231R1 <https://wg21.link/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 <https://wg21.link/P2325R3>`__","Views should not be required to be default constructible","2021-06 (Virtual)","|Complete|","16.0",""
"`P2210R2 <https://wg21.link/P2210R2>`__","Superior String Splitting","2021-06 (Virtual)","|Complete|","16.0",""
"`P2216R3 <https://wg21.link/P2216R3>`__","std::format improvements","2021-06 (Virtual)","|Complete|","15.0",""
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx2cPapers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"`P0792R14 <https://wg21.link/P0792R14>`__","``function_ref``: a type-erased callable reference","2023-06 (Varna)","","",""
"`P2874R2 <https://wg21.link/P2874R2>`__","Mandating Annex D Require No More","2023-06 (Varna)","","",""
"`P2757R3 <https://wg21.link/P2757R3>`__","Type-checking format args","2023-06 (Varna)","","",""
"`P2637R3 <https://wg21.link/P2637R3>`__","Member ``visit``","2023-06 (Varna)","|Complete|","19.0",""
"`P2637R3 <https://wg21.link/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 <https://wg21.link/P2419R2>`__."
"`P2641R4 <https://wg21.link/P2641R4>`__","Checking if a ``union`` alternative is active","2023-06 (Varna)","","",""
"`P1759R6 <https://wg21.link/P1759R6>`__","Native handles and file streams","2023-06 (Varna)","|Complete|","18.0",""
"`P2697R1 <https://wg21.link/P2697R1>`__","Interfacing ``bitset`` with ``string_view``","2023-06 (Varna)","|Complete|","18.0",""
Expand Down
11 changes: 10 additions & 1 deletion libcxx/include/version
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ __cpp_lib_nonmember_container_access 201411L <array> <deque>
__cpp_lib_not_fn 201603L <functional>
__cpp_lib_null_iterators 201304L <iterator>
__cpp_lib_optional 202110L <optional>
202106L // C++20
201606L // C++17
__cpp_lib_optional_range_support 202406L <optional>
__cpp_lib_out_ptr 202311L <memory>
Expand Down Expand Up @@ -261,7 +262,9 @@ __cpp_lib_uncaught_exceptions 201411L <exception>
__cpp_lib_unordered_map_try_emplace 201411L <unordered_map>
__cpp_lib_unreachable 202202L <utility>
__cpp_lib_unwrap_ref 201811L <functional>
__cpp_lib_variant 202102L <variant>
__cpp_lib_variant 202306L <variant>
202106L // C++20
202102L // C++17
__cpp_lib_void_t 201411L <type_traits>

*/
Expand Down Expand Up @@ -427,6 +430,8 @@ __cpp_lib_void_t 201411L <type_traits>
# 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
Expand All @@ -453,6 +458,8 @@ __cpp_lib_void_t 201411L <type_traits>
# 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
Expand Down Expand Up @@ -570,6 +577,8 @@ __cpp_lib_void_t 201411L <type_traits>
// # 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
*/
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <variant>
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
*/

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions libcxx/utils/generate_feature_test_macro_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
},
{
Expand Down Expand Up @@ -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"],
},
Expand Down
Loading