diff --git a/libcxx/include/__config b/libcxx/include/__config index c197851f1c8fe..2d6c063d69149 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -568,10 +568,12 @@ typedef __char32_t char32_t; _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \ _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++23-extensions") \ + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wc++26-extensions") \ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++14-extensions") \ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++17-extensions") \ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++20-extensions") \ _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++23-extensions") + _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wc++26-extensions") # define _LIBCPP_POP_EXTENSION_DIAGNOSTICS _LIBCPP_DIAGNOSTIC_POP # else # define _LIBCPP_PUSH_EXTENSION_DIAGNOSTICS diff --git a/libcxx/include/__fwd/pair.h b/libcxx/include/__fwd/pair.h index cf07eabab6903..c75a41032774a 100644 --- a/libcxx/include/__fwd/pair.h +++ b/libcxx/include/__fwd/pair.h @@ -28,23 +28,22 @@ inline const bool __is_pair_v = false; template inline const bool __is_pair_v > = true; -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(pair<_T1, _T2>&) _NOEXCEPT; +// clang-format fails miserably with pack subscripting currently +// clang-format off +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Ts...[_Ip]& get(pair<_Ts...>&) _NOEXCEPT; -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(const pair<_T1, _T2>&) _NOEXCEPT; +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ts...[_Ip]& get(const pair<_Ts...>&) _NOEXCEPT; #ifndef _LIBCPP_CXX03_LANG -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(pair<_T1, _T2>&&) _NOEXCEPT; +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Ts...[_Ip]&& get(pair<_Ts...>&&) _NOEXCEPT; -template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(const pair<_T1, _T2>&&) _NOEXCEPT; +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ts...[_Ip]&& get(const pair<_Ts...>&&) _NOEXCEPT; #endif +// clang-format on _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__fwd/tuple.h b/libcxx/include/__fwd/tuple.h index dc96c03e2024f..e48e2c003ec7e 100644 --- a/libcxx/include/__fwd/tuple.h +++ b/libcxx/include/__fwd/tuple.h @@ -43,21 +43,20 @@ struct tuple_element<_Ip, tuple<_Tp...> > { template struct tuple_size; +// clang-format fails miserably with pack subscripting currently +// clang-format off template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(tuple<_Tp...>&) _NOEXCEPT; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp...[_Ip]& get(tuple<_Tp...>&) _NOEXCEPT; template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(const tuple<_Tp...>&) _NOEXCEPT; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp...[_Ip]& get(const tuple<_Tp...>&) _NOEXCEPT; template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(tuple<_Tp...>&&) _NOEXCEPT; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp...[_Ip]&& get(tuple<_Tp...>&&) _NOEXCEPT; template -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(const tuple<_Tp...>&&) _NOEXCEPT; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp...[_Ip]&& get(const tuple<_Tp...>&&) _NOEXCEPT; +// clang-format on #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h index 33694c52430f1..ab2050df78588 100644 --- a/libcxx/include/__utility/pair.h +++ b/libcxx/include/__utility/pair.h @@ -618,29 +618,28 @@ struct __get_pair<1> { } }; -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(pair<_T1, _T2>& __p) _NOEXCEPT { +// clang-format fails miserably with pack subscripting currently +// clang-format off +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Ts...[_Ip]& get(pair<_Ts...>& __p) _NOEXCEPT { return __get_pair<_Ip>::get(__p); } -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(const pair<_T1, _T2>& __p) _NOEXCEPT { +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ts...[_Ip]& get(const pair<_Ts...>& __p) _NOEXCEPT { return __get_pair<_Ip>::get(__p); } -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(pair<_T1, _T2>&& __p) _NOEXCEPT { +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Ts...[_Ip]&& get(pair<_Ts...>&& __p) _NOEXCEPT { return __get_pair<_Ip>::get(std::move(__p)); } -template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(const pair<_T1, _T2>&& __p) _NOEXCEPT { +template +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ts...[_Ip]&& get(const pair<_Ts...>&& __p) _NOEXCEPT { return __get_pair<_Ip>::get(std::move(__p)); } +// clang-format on #if _LIBCPP_STD_VER >= 14 template diff --git a/libcxx/include/tuple b/libcxx/include/tuple index b0d0c38b115a2..7bc77f9ccbd6a 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -582,17 +582,17 @@ class _LIBCPP_NO_SPECIALIZATIONS tuple { _BaseT __base_; + // clang-format fails miserably with pack subscripting currently + // clang-format off template - friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT; + friend _LIBCPP_CONSTEXPR_SINCE_CXX14 _Up...[_Jp]& get(tuple<_Up...>&) _NOEXCEPT; template - friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type& - get(const tuple<_Up...>&) _NOEXCEPT; + friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Up...[_Jp]& get(const tuple<_Up...>&) _NOEXCEPT; template - friend _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Jp, tuple<_Up...> >::type&& - get(tuple<_Up...>&&) _NOEXCEPT; + friend _LIBCPP_CONSTEXPR_SINCE_CXX14 _Up...[_Jp]&& get(tuple<_Up...>&&) _NOEXCEPT; template - friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Jp, tuple<_Up...> >::type&& - get(const tuple<_Up...>&&) _NOEXCEPT; + friend _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Up...[_Jp]&& get(const tuple<_Up...>&&) _NOEXCEPT; + // clang-format on public: using __trivially_relocatable _LIBCPP_NODEBUG = @@ -1119,30 +1119,24 @@ swap(const tuple<_Tp...>& __lhs, // get template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(tuple<_Tp...>& __t) _NOEXCEPT { - using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type; - return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get(); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp...[_Ip]& get(tuple<_Tp...>& __t) _NOEXCEPT { + return static_cast<__tuple_leaf<_Ip, _Tp...[_Ip]>&>(__t.__base_).get(); } template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(const tuple<_Tp...>& __t) _NOEXCEPT { - using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type; - return static_cast&>(__t.__base_).get(); +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp...[_Ip]& get(const tuple<_Tp...>& __t) _NOEXCEPT { + return static_cast&>(__t.__base_).get(); } template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(tuple<_Tp...>&& __t) _NOEXCEPT { - using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp...[_Ip]&& get(tuple<_Tp...>&& __t) _NOEXCEPT { + using type _LIBCPP_NODEBUG = _Tp...[_Ip]; return static_cast(static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } template -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(const tuple<_Tp...>&& __t) _NOEXCEPT { - using type _LIBCPP_NODEBUG = typename tuple_element<_Ip, tuple<_Tp...> >::type; +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp...[_Ip]&& get(const tuple<_Tp...>&& __t) _NOEXCEPT { + using type _LIBCPP_NODEBUG = _Tp...[_Ip]; return static_cast(static_cast&&>(__t.__base_).get()); }