From patchwork Mon Nov 21 10:50:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 126734 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 B5D41B7201 for ; Mon, 21 Nov 2011 21:51:50 +1100 (EST) Received: (qmail 25490 invoked by alias); 21 Nov 2011 10:51:45 -0000 Received: (qmail 25478 invoked by uid 22791); 21 Nov 2011 10:51:43 -0000 X-SWARE-Spam-Status: No, hits=-2.8 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; Mon, 21 Nov 2011 10:51:07 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pALAp52I013533 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Nov 2011 10:51:06 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pALAp4kt000571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Nov 2011 10:51:04 GMT Received: from abhmt113.oracle.com (abhmt113.oracle.com [141.146.116.65]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id pALAowBH003336; Mon, 21 Nov 2011 04:50:59 -0600 Received: from [192.168.1.4] (/79.53.13.169) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Nov 2011 02:50:58 -0800 Message-ID: <4ECA2CEB.6060907@oracle.com> Date: Mon, 21 Nov 2011 11:50:19 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Jason Merrill CC: gcc-patches List , =?ISO-8859-1?Q?Daniel_K?= =?ISO-8859-1?Q?r=FCgler?= Subject: Re: C++ PATCH for c++/48322 (broken handling of variadic parms on multiple levels) References: <4EC9967E.2000308@redhat.com> <4EC9A30F.3010903@oracle.com> <4EC9B201.5060309@redhat.com> In-Reply-To: <4EC9B201.5060309@redhat.com> 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 On 11/21/2011 03:05 AM, Jason Merrill wrote: > On 11/20/2011 08:02 PM, Paolo Carlini wrote: >> .. also, I was under the impression that c++/48322 was the only reason >> we couldn't write something very simple, thus no __all_convertible, ie, >> something using directly: >> >> enable_if<__and_...>::value>::type > > Yep, you can do that now. > >> That would be a great improvement, even if we need to SFINAE separately >> for equal sizeofs. > > You don't need to, you can just drop the sizeof check now. Ah great. Thus I tested and committed the below. Thanks again for the explanations to both of you, Paolo. /////////////////// 2011-11-21 Paolo Carlini * include/std/tuple (__conv_types, __one_by_one_convertible, __all_convertible): Remove. (tuple<>::tuple(_UElements&&...), tuple<>::tuple(const tuple<_UElements...>&), tuple<>::tuple(tuple<_UElements...>&&)): Remove wa for c++/48322. * testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error line number. Index: include/std/tuple =================================================================== --- include/std/tuple (revision 181554) +++ include/std/tuple (working copy) @@ -69,35 +69,6 @@ struct __add_r_ref<_Tp&> { typedef _Tp& type; }; - // To work around c++/49225 aka c++/48322. - template - struct __conv_types { }; - - template - struct __one_by_one_convertible - : public false_type { }; - - template - struct __one_by_one_convertible<__conv_types<_Tp>, __conv_types<_Up>> - : public is_convertible<_Tp, _Up>::type { }; - - template - struct __one_by_one_convertible<__conv_types<_T1, _TR...>, - __conv_types<_U1, _UR...>> - : public __and_, - __one_by_one_convertible<__conv_types<_TR...>, - __conv_types<_UR...>>>::type - { }; - - template - struct __all_convertible; - - template - struct __all_convertible<__conv_types<_TTypes...>, - __conv_types<_UTypes...>> - : public __one_by_one_convertible<__conv_types<_TTypes...>, - __conv_types<_UTypes...>>::type { }; - template struct _Head_base; @@ -407,13 +378,9 @@ constexpr tuple(const _Elements&... __elements) : _Inherited(__elements...) { } - template::type, - typename = typename - enable_if<__all_convertible<__conv_types<_UElements...>, - __conv_types<_Elements...> >::value - >::type> + template...>::value>::type> explicit constexpr tuple(_UElements&&... __elements) : _Inherited(std::forward<_UElements>(__elements)...) { } @@ -423,21 +390,15 @@ constexpr tuple(tuple&&) = default; template, - __all_convertible<__conv_types, - __conv_types<_Elements...>> - >::value>::type> + enable_if<__and_...>::value>::type> constexpr tuple(const tuple<_UElements...>& __in) : _Inherited(static_cast&>(__in)) { } template, - __all_convertible<__conv_types<_UElements...>, - __conv_types<_Elements...>> - >::value>::type> + enable_if<__and_...>::value>::type> constexpr tuple(tuple<_UElements...>&& __in) : _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { } Index: testsuite/20_util/uses_allocator/cons_neg.cc =================================================================== --- testsuite/20_util/uses_allocator/cons_neg.cc (revision 181554) +++ testsuite/20_util/uses_allocator/cons_neg.cc (working copy) @@ -44,4 +44,4 @@ tuple t(allocator_arg, a, 1); } -// { dg-error "no matching function" "" { target *-*-* } 141 } +// { dg-error "no matching function" "" { target *-*-* } 112 }