Commit fae3f459 by Paolo Carlini Committed by Paolo Carlini

tuple (make_tuple, [...]): Declare constexpr.

2011-09-15  Paolo Carlini  <paolo.carlini@oracle.com>

	* 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
parent 867e710a
2011-09-15 Paolo Carlini <paolo.carlini@oracle.com>
* 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 <fdumont@gcc.gnu.org> 2011-09-14 François Dumont <fdumont@gcc.gnu.org>
Paolo Carlini <paolo.carlini@oracle.com> Paolo Carlini <paolo.carlini@oracle.com>
......
...@@ -273,6 +273,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -273,6 +273,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _Tuple_impl(const _Tuple_impl&) = default; constexpr _Tuple_impl(const _Tuple_impl&) = default;
constexpr
_Tuple_impl(_Tuple_impl&& __in) _Tuple_impl(_Tuple_impl&& __in)
noexcept(__and_<is_nothrow_move_constructible<_Head>, noexcept(__and_<is_nothrow_move_constructible<_Head>,
is_nothrow_move_constructible<_Inherited>>::value) is_nothrow_move_constructible<_Inherited>>::value)
...@@ -285,7 +286,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -285,7 +286,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { } _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { }
template<typename _UHead, typename... _UTails> template<typename _UHead, typename... _UTails>
_Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) constexpr _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
: _Inherited(std::move : _Inherited(std::move
(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
_Base(std::forward<_UHead> _Base(std::forward<_UHead>
...@@ -872,7 +873,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -872,7 +873,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: DR 705. // NB: DR 705.
template<typename... _Elements> template<typename... _Elements>
inline tuple<typename __decay_and_strip<_Elements>::__type...> constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
make_tuple(_Elements&&... __args) make_tuple(_Elements&&... __args)
{ {
typedef tuple<typename __decay_and_strip<_Elements>::__type...> typedef tuple<typename __decay_and_strip<_Elements>::__type...>
...@@ -881,7 +882,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -881,7 +882,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename... _Elements> template<typename... _Elements>
inline tuple<_Elements&&...> constexpr tuple<_Elements&&...>
forward_as_tuple(_Elements&&... __args) noexcept forward_as_tuple(_Elements&&... __args) noexcept
{ return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); } { return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
......
...@@ -29,7 +29,6 @@ bool test __attribute__((unused)) = true; ...@@ -29,7 +29,6 @@ bool test __attribute__((unused)) = true;
// make_tuple // make_tuple
#if 0
void void
test_make_tuple() test_make_tuple()
{ {
...@@ -43,7 +42,6 @@ test_make_tuple() ...@@ -43,7 +42,6 @@ test_make_tuple()
constexpr tuple_type p1 = std::make_tuple(22, 22.222, 77799); constexpr tuple_type p1 = std::make_tuple(22, 22.222, 77799);
} }
} }
#endif
// get // get
void void
...@@ -77,10 +75,7 @@ test_tuple_cat() ...@@ -77,10 +75,7 @@ test_tuple_cat()
int int
main() main()
{ {
#if 0
test_make_tuple(); test_make_tuple();
#endif
test_get(); test_get();
test_tuple_cat(); test_tuple_cat();
......
...@@ -51,7 +51,7 @@ main() ...@@ -51,7 +51,7 @@ main()
// { dg-warning "note" "" { target *-*-* } 485 } // { dg-warning "note" "" { target *-*-* } 485 }
// { dg-warning "note" "" { target *-*-* } 479 } // { dg-warning "note" "" { target *-*-* } 479 }
// { dg-warning "note" "" { target *-*-* } 468 } // { dg-warning "note" "" { target *-*-* } 468 }
// { dg-warning "note" "" { target *-*-* } 840 } // { dg-warning "note" "" { target *-*-* } 841 }
// { dg-warning "note" "" { target *-*-* } 1056 } // { dg-warning "note" "" { target *-*-* } 1056 }
// { dg-warning "note" "" { target *-*-* } 1050 } // { dg-warning "note" "" { target *-*-* } 1050 }
// { dg-warning "note" "" { target *-*-* } 342 } // { dg-warning "note" "" { target *-*-* } 342 }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment