diff --git a/libcxx/docs/Status/Cxx2bPapers.csv b/libcxx/docs/Status/Cxx2bPapers.csv --- a/libcxx/docs/Status/Cxx2bPapers.csv +++ b/libcxx/docs/Status/Cxx2bPapers.csv @@ -33,7 +33,7 @@ "`P2077R3 `__","LWG","Heterogeneous erasure overloads for associative containers","October 2021","","" "`P2251R1 `__","LWG","Require ``span`` & ``basic_string_view`` to be Trivially Copyable","October 2021","|Complete|","14.0" "`P2301R1 `__","LWG","Add a ``pmr`` alias for ``std::stacktrace``","October 2021","","" -"`P2321R2 `__","LWG","``zip``","October 2021","","" +"`P2321R2 `__","LWG","``zip``","October 2021","|In Progress|","14.0" "`P2340R1 `__","LWG","Clarifying the status of the 'C headers'","October 2021","","" "`P2393R1 `__","LWG","Cleaning up ``integer``-class types","October 2021","","" "`P2401R0 `__","LWG","Add a conditional ``noexcept`` specification to ``std::exchange``","October 2021","|Complete|","14.0" diff --git a/libcxx/include/tuple b/libcxx/include/tuple --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -73,6 +73,19 @@ void swap(tuple&) noexcept(AND(swap(declval(), declval())...)); // constexpr in C++20 }; + +template class TQual, template class UQual> + requires requires { typename tuple, UQual>...>; } +struct basic_common_reference, tuple, TQual, UQual> { + using type = tuple, UQual>...>; +}; + +template + requires requires { typename tuple...>; } +struct common_type, tuple> { + using type = tuple...>; +}; + template tuple(T...) -> tuple; // since C++17 template @@ -1103,7 +1116,22 @@ void swap(tuple&) _NOEXCEPT {} }; -#if _LIBCPP_STD_VER >= 17 + +#if _LIBCPP_STD_VER > 20 +template class _TQual, template class _UQual> + requires requires { typename tuple, _UQual<_UTypes...>>>; } +struct basic_common_reference, tuple<_UTypes...>, _TQual, _UQual> { + using type = tuple, _UQual<_UTypes>>...>; +}; + +template + requires requires { typename tuple...>; } +struct common_type, tuple<_UTypes...>> { + using type = tuple...>; +}; +#endif + +#if _LIBCPP_STD_VER > 14 template tuple(_Tp...) -> tuple<_Tp...>; template diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_reference.compile.pass.cpp @@ -13,8 +13,11 @@ // type_traits // common_reference +#include #include +#include "test_macros.h" + using std::common_reference; using std::common_reference_t; using std::is_same_v; @@ -193,4 +196,11 @@ // -- Otherwise, there shall be no member type. static_assert(!has_type >); +#if TEST_STD_VER > 20 +static_assert(is_same_v>, std::tuple>); +static_assert(is_same_v, std::tuple>, std::tuple>); +static_assert(is_same_v, std::tuple>, + std::tuple>); +#endif + int main(int, char**) { return 0; } diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include "test_macros.h" @@ -340,5 +341,11 @@ static_assert(std::is_same::type, int>::value, ""); #endif +#if TEST_STD_VER > 20 + static_assert(std::is_same_v>, std::tuple>); + static_assert(std::is_same_v, std::tuple>, std::tuple>); + static_assert(std::is_same_v, std::tuple>, std::tuple>); +#endif + return 0; }