forked from OSchip/llvm-project
[libc++] Fix constexpr-ness of std::tuple's constructor
Mentioned in https://reviews.llvm.org/D96523.
This commit is contained in:
parent
3489c2d7b1
commit
ef89e8ca1c
|
@ -466,7 +466,7 @@ public:
|
|||
_IsImpDefault<_Tp>... // explicit check
|
||||
>::value
|
||||
, int> = 0>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
tuple()
|
||||
_NOEXCEPT_(_And<is_nothrow_default_constructible<_Tp>...>::value)
|
||||
{ }
|
||||
|
@ -896,7 +896,7 @@ public:
|
|||
_EnableImplicitMoveFromPair<_Up1, _Up2, _Tp...>
|
||||
>::value
|
||||
, int> = 0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
tuple(pair<_Up1, _Up2>&& __p)
|
||||
_NOEXCEPT_((_And<
|
||||
is_nothrow_constructible<_FirstType<_Tp...>, _Up1>,
|
||||
|
@ -911,7 +911,7 @@ public:
|
|||
_EnableExplicitMoveFromPair<_Up1, _Up2, _Tp...>
|
||||
>::value
|
||||
, int> = 0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
explicit tuple(pair<_Up1, _Up2>&& __p)
|
||||
_NOEXCEPT_((_And<
|
||||
is_nothrow_constructible<_FirstType<_Tp...>, _Up1>,
|
||||
|
|
|
@ -47,5 +47,14 @@ int main(int, char**)
|
|||
assert(std::get<1>(t1)->id_ == 3);
|
||||
}
|
||||
|
||||
#if TEST_STD_VER > 11
|
||||
{
|
||||
using pair_t = std::pair<int, char>;
|
||||
constexpr std::tuple<long, long> t(pair_t(0, 'a'));
|
||||
static_assert(std::get<0>(t) == 0, "");
|
||||
static_assert(std::get<1>(t) == 'a', "");
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue