public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [v3] Declare std::make_tuple, std::forward_as_tuple constexpr
@ 2011-09-16  7:02 Paolo Carlini
  0 siblings, 0 replies; only message in thread
From: Paolo Carlini @ 2011-09-16  7:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++

[-- Attachment #1: Type: text/plain, Size: 81 bytes --]

Hi,

tested x86_64-linux, committed to mainline.

Paolo.

//////////////////////

[-- Attachment #2: CL_tuple_constexpr_2 --]
[-- Type: text/plain, Size: 355 bytes --]

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.

[-- Attachment #3: patch_tuple_constexpr_2 --]
[-- Type: text/plain, Size: 3237 bytes --]

Index: include/std/tuple
===================================================================
--- include/std/tuple	(revision 178898)
+++ include/std/tuple	(working copy)
@@ -273,6 +273,7 @@
 
       constexpr _Tuple_impl(const _Tuple_impl&) = default;
 
+      constexpr
       _Tuple_impl(_Tuple_impl&& __in)
       noexcept(__and_<is_nothrow_move_constructible<_Head>,
 	              is_nothrow_move_constructible<_Inherited>>::value)
@@ -285,9 +286,9 @@
 	  _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { }
 
       template<typename _UHead, typename... _UTails>
-        _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 @@
       template<typename _U1, typename _U2, typename = typename
 	       enable_if<__and_<is_convertible<_U1, _T1>,
 				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 @@
 
   // NB: DR 705.
   template<typename... _Elements>
-    inline tuple<typename __decay_and_strip<_Elements>::__type...>
+    constexpr tuple<typename __decay_and_strip<_Elements>::__type...>
     make_tuple(_Elements&&... __args)
     {
       typedef tuple<typename __decay_and_strip<_Elements>::__type...>
@@ -881,7 +882,7 @@
     }
 
   template<typename... _Elements>
-    inline tuple<_Elements&&...>
+    constexpr tuple<_Elements&&...>
     forward_as_tuple(_Elements&&... __args) noexcept
     { return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
 
Index: testsuite/20_util/tuple/creation_functions/constexpr.cc
===================================================================
--- testsuite/20_util/tuple/creation_functions/constexpr.cc	(revision 178898)
+++ testsuite/20_util/tuple/creation_functions/constexpr.cc	(working copy)
@@ -29,7 +29,6 @@
 
 
 // make_tuple
-#if 0
 void
 test_make_tuple()
 {
@@ -43,7 +42,6 @@
     constexpr tuple_type p1 = std::make_tuple(22, 22.222, 77799);
   }
 }
-#endif
 
 // get
 void
@@ -77,10 +75,7 @@
 int
 main()
 {
-#if 0
   test_make_tuple();
-#endif
-
   test_get();
   test_tuple_cat();
 
Index: testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
===================================================================
--- testsuite/20_util/weak_ptr/comparison/cmp_neg.cc	(revision 178898)
+++ testsuite/20_util/weak_ptr/comparison/cmp_neg.cc	(working copy)
@@ -51,7 +51,7 @@
 // { 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 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-16  0:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16  7:02 [v3] Declare std::make_tuple, std::forward_as_tuple constexpr Paolo Carlini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).