@@ -258,6 +258,7 @@ template <class... Types>
258258# include < __type_traits/maybe_const.h>
259259# include < __type_traits/nat.h>
260260# include < __type_traits/negation.h>
261+ # include < __type_traits/reference_constructs_from_temporary.h>
261262# include < __type_traits/remove_cv.h>
262263# include < __type_traits/remove_cvref.h>
263264# include < __type_traits/remove_reference.h>
@@ -308,15 +309,6 @@ template <size_t _Ip, class _Hp, bool>
308309class __tuple_leaf {
309310 _Hp __value_;
310311
311- template <class _Tp >
312- static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference () {
313- # if __has_keyword(__reference_binds_to_temporary)
314- return !__reference_binds_to_temporary (_Hp, _Tp);
315- # else
316- return true ;
317- # endif
318- }
319-
320312public:
321313 _LIBCPP_CONSTEXPR_SINCE_CXX14 __tuple_leaf& operator =(const __tuple_leaf&) = delete ;
322314
@@ -346,15 +338,15 @@ public:
346338 _LIBCPP_HIDE_FROM_ABI
347339 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf (_Tp&& __t ) noexcept (is_nothrow_constructible<_Hp, _Tp>::value)
348340 : __value_(std::forward<_Tp>(__t )) {
349- static_assert (__can_bind_reference< _Tp&&>() ,
341+ static_assert (!__reference_constructs_from_temporary_v<_Hp, _Tp&&>,
350342 " Attempted construction of reference element binds to a temporary whose lifetime has ended" );
351343 }
352344
353345 template <class _Tp , class _Alloc >
354346 _LIBCPP_HIDE_FROM_ABI
355347 _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __tuple_leaf (integral_constant<int , 0 >, const _Alloc&, _Tp&& __t )
356348 : __value_(std::forward<_Tp>(__t )) {
357- static_assert (__can_bind_reference< _Tp&&>() ,
349+ static_assert (!__reference_constructs_from_temporary_v<_Hp, _Tp&&>,
358350 " Attempted construction of reference element binds to a temporary whose lifetime has ended" );
359351 }
360352
0 commit comments