diff --git a/libcxx/include/tuple b/libcxx/include/tuple index 5fa6ef36b53a..9f716fb20c8e 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -73,7 +73,7 @@ public: const unspecified ignore; template tuple make_tuple(T&&...); // constexpr in C++14 -template tuple forward_as_tuple(T&&...) noexcept; +template tuple forward_as_tuple(T&&...) noexcept; // constexpr in C++14 template tuple tie(T&...) noexcept; template tuple tuple_cat(Tuples&&... tpls); // constexpr in C++14 @@ -833,14 +833,6 @@ make_tuple(_Tp&&... __t) template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple<_Tp&&...> -__forward_as_tuple(_Tp&&... __t) _NOEXCEPT -{ - return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) _NOEXCEPT { return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...); @@ -1041,7 +1033,7 @@ struct __tuple_cat, __tuple_indices<_I0...>, __tuple_indices<_J typename __tuple_cat_return_ref&&, _Tuple0&&>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0) { - return __forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))..., + return forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))..., get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); } @@ -1056,7 +1048,7 @@ struct __tuple_cat, __tuple_indices<_I0...>, __tuple_indices<_J tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>, typename __make_tuple_indices::value>::type, typename __make_tuple_indices::value>::type>() - (__forward_as_tuple( + (forward_as_tuple( _VSTD::forward<_Types>(get<_I0>(__t))..., get<_J0>(_VSTD::forward<_Tuple0>(__t0))... ), diff --git a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp index 148850ee0d62..5e84ff8e882d 100644 --- a/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp +++ b/libcxx/test/utilities/tuple/tuple.tuple/tuple.creation/forward_as_tuple.pass.cpp @@ -51,6 +51,15 @@ test2a(const Tuple& t) assert(std::get<1>(t) == 'a'); } +#if _LIBCPP_STD_VER > 11 +template +constexpr int +test3(const Tuple& t) +{ + return std::tuple_size::value; +} +#endif + int main() { { @@ -67,5 +76,8 @@ int main() double i = 2.5; char c = 'a'; test2a(std::forward_as_tuple(i, c)); +#if _LIBCPP_STD_VER > 11 + static_assert ( test3 (std::forward_as_tuple(i, c)) == 2, "" ); +#endif } }