From fae3f4598af23b48fed264052e33d5516e31a56c Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 16 Sep 2011 00:41:33 +0000 Subject: [PATCH] tuple (make_tuple, [...]): Declare constexpr. 2011-09-15 Paolo Carlini * include/std/tuple (make_tuple, forward_as_tuple): Declare constexpr. (_Tuple_impl<>::_Tuple_impl(_Tuple_impl<>&&)): Likewise. * testsuite/20_util/tuple/creation_functions/constexpr.cc: Enable make_tuple test. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning line number. From-SVN: r178904 --- libstdc++-v3/ChangeLog | 11 ++++++++++- libstdc++-v3/include/std/tuple | 13 +++++++------ .../20_util/tuple/creation_functions/constexpr.cc | 5 ----- .../20_util/weak_ptr/comparison/cmp_neg.cc | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8de9659bf88..9b334570b97 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2011-09-15 Paolo Carlini + + * include/std/tuple (make_tuple, forward_as_tuple): Declare constexpr. + (_Tuple_impl<>::_Tuple_impl(_Tuple_impl<>&&)): Likewise. + * testsuite/20_util/tuple/creation_functions/constexpr.cc: Enable + make_tuple test. + * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning + line number. + 2011-09-14 François Dumont Paolo Carlini @@ -13,7 +22,7 @@ Likewise. 2011-09-13 Paul Brook - + * libsupc++/eh_arm.cc (__cxa_end_cleanup): Add C6X implementation. * libsupc++/eh_call.cc (__cxa_call_unexpected): Set rtti_base. * libsupc++/eh_personality.cc (NO_SIZE_OF_ENCODED_VALUE): Remove diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 1eec951fd15..51be289d506 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -273,6 +273,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr _Tuple_impl(const _Tuple_impl&) = default; + constexpr _Tuple_impl(_Tuple_impl&& __in) noexcept(__and_, is_nothrow_move_constructible<_Inherited>>::value) @@ -285,9 +286,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { } template - _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) - : _Inherited(std::move - (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), + constexpr _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) + : _Inherited(std::move + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), _Base(std::forward<_UHead> (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) { } @@ -580,7 +581,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template, is_convertible<_U2, _T2>>::value>::type> - constexpr tuple(pair<_U1, _U2>&& __in) + constexpr tuple(pair<_U1, _U2>&& __in) : _Inherited(std::forward<_U1>(__in.first), std::forward<_U2>(__in.second)) { } @@ -872,7 +873,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // NB: DR 705. template - inline tuple::__type...> + constexpr tuple::__type...> make_tuple(_Elements&&... __args) { typedef tuple::__type...> @@ -881,7 +882,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - inline tuple<_Elements&&...> + constexpr tuple<_Elements&&...> forward_as_tuple(_Elements&&... __args) noexcept { return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); } diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc index 5b816a59bbb..dcf6fe7d410 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc @@ -29,7 +29,6 @@ bool test __attribute__((unused)) = true; // make_tuple -#if 0 void test_make_tuple() { @@ -43,7 +42,6 @@ test_make_tuple() constexpr tuple_type p1 = std::make_tuple(22, 22.222, 77799); } } -#endif // get void @@ -77,10 +75,7 @@ test_tuple_cat() int main() { -#if 0 test_make_tuple(); -#endif - test_get(); test_tuple_cat(); diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc index cb4b4a9bbd9..a3abadf4622 100644 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc @@ -51,7 +51,7 @@ main() // { dg-warning "note" "" { target *-*-* } 485 } // { dg-warning "note" "" { target *-*-* } 479 } // { dg-warning "note" "" { target *-*-* } 468 } -// { dg-warning "note" "" { target *-*-* } 840 } +// { dg-warning "note" "" { target *-*-* } 841 } // { dg-warning "note" "" { target *-*-* } 1056 } // { dg-warning "note" "" { target *-*-* } 1050 } // { dg-warning "note" "" { target *-*-* } 342 }