From patchwork Fri Sep 16 00:42:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 114873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5EC44B6F65 for ; Fri, 16 Sep 2011 10:43:27 +1000 (EST) Received: (qmail 13996 invoked by alias); 16 Sep 2011 00:43:23 -0000 Received: (qmail 13980 invoked by uid 22791); 16 Sep 2011 00:43:21 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Sep 2011 00:43:07 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p8G0h5vp022948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Sep 2011 00:43:06 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p8G0h4Nq005212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Sep 2011 00:43:05 GMT Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p8G0gxWV015496; Thu, 15 Sep 2011 19:42:59 -0500 Received: from [192.168.1.4] (/79.51.11.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 15 Sep 2011 17:42:59 -0700 Message-ID: <4E729B7F.5020005@oracle.com> Date: Fri, 16 Sep 2011 02:42:39 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110907 Thunderbird/6.0.2 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Declare std::make_tuple, std::forward_as_tuple constexpr X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, tested x86_64-linux, committed to mainline. Paolo. ////////////////////// 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. 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<_Inherited>>::value) @@ -285,9 +286,9 @@ _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 @@ 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 @@ // NB: DR 705. template - inline tuple::__type...> + constexpr tuple::__type...> make_tuple(_Elements&&... __args) { typedef tuple::__type...> @@ -881,7 +882,7 @@ } template - 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 }