From patchwork Thu May 15 10:38:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 349162 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1990B140094 for ; Thu, 15 May 2014 20:38:18 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; q=dns; s= default; b=X0S6RqQWwn3Xk08EiilDSpgX0TG4PhX1EbKd72rAzmSjznDh0fcpc kTdu35ejSpPPSYHgBgvpxBetES9UNtUlcqacgQjJSz1UjPd5MEnt+bLJzVafOLsu xpx4aWE34jBGsdewo2vLBfn8B3xv26uFZ9St5SdRArkxJpe7sMPkpw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=default; bh=5GeDwEaKrvDoTgndZLDCkUe2tbQ=; b=eA0Ct9G/KSXGPck4YmEgF+aywFuF Zi7fSJAZte4b9M7CsYqnK8aR+jKJOq/nBV0lQ3h3dVAr8+DhxhlDiYLNbgEsXrVk 2ritkJufoI0yhIF5YjRmj0xBkKmRhozBumnWlvMmmIO+3n9zPW1P53EY6myU2bq9 MjaMSQ/+T8/GwWA= Received: (qmail 8704 invoked by alias); 15 May 2014 10:38:11 -0000 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 Received: (qmail 8684 invoked by uid 89); 15 May 2014 10:38:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 May 2014 10:38:10 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4FAc8qo008543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 May 2014 06:38:08 -0400 Received: from localhost (vpn1-6-198.ams2.redhat.com [10.36.6.198]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4FAc7w9009179; Thu, 15 May 2014 06:38:08 -0400 Date: Thu, 15 May 2014 11:38:07 +0100 From: Jonathan Wakely To: Daniel =?iso-8859-1?Q?Kr=FCgler?= Cc: libstdc++ , gcc-patches List Subject: Re: [patch] Simplify std::tuple helpers and fix C++14 bug. Message-ID: <20140515103807.GH10556@redhat.com> References: <20140514222236.GG10556@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) On 15/05/14 07:36 +0200, Daniel Krügler wrote: >Looking at the definition of the new alias > >__cv_tuple_size > >you might want to apply LWG 2313 > >http://cplusplus.github.io/LWG/lwg-defects.html#2313 > >and simplify its definition even further. I forgot about that. With that resolution the __cv_tuple_size alias doesn't seem worth using, it's simple enough anyway. Thanks! Tested x86_64-linux, committed to trunk. commit 420a40952d148f64e73517c75060e6ff17e7c93b Author: Jonathan Wakely Date: Thu May 15 11:02:30 2014 +0100 * include/std/tuple (tuple_size): Implement LWG 2313. * include/std/array (tuple_size, tuple_element): Add Doxygen comments. * include/std/utility (tuple_size, tuple_element): Likewise. * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Adjust dg-error line number. diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 22947ce..cc2c864 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -306,6 +306,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class tuple_size; + /// Partial specialization for std::array template struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>> : public integral_constant { }; @@ -314,6 +315,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template class tuple_element; + /// Partial specialization for std::array template struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>> { diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 95c197d..ef8aa5a 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -693,18 +693,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct tuple_size; - template> - using __cv_tuple_size = integral_constant< - typename remove_cv::type, _Ts::value>; - + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2313. tuple_size should always derive from integral_constant template - struct tuple_size : __cv_tuple_size<_Tp> { }; + struct tuple_size + : integral_constant::value> { }; template - struct tuple_size : __cv_tuple_size<_Tp> { }; + struct tuple_size + : integral_constant::value> { }; template - struct tuple_size : __cv_tuple_size<_Tp> { }; + struct tuple_size + : integral_constant::value> { }; /// class tuple_size template diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 4da9209..6d12839e 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -84,14 +84,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class tuple_element; // Various functions which give std::pair a tuple-like interface. + + /// Partial specialization for std::pair template struct tuple_size> : public integral_constant { }; + /// Partial specialization for std::pair template struct tuple_element<0, std::pair<_Tp1, _Tp2>> { typedef _Tp1 type; }; + /// Partial specialization for std::pair template struct tuple_element<1, std::pair<_Tp1, _Tp2>> { typedef _Tp2 type; }; diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc index f80798c..4b1e5ae 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc @@ -23,4 +23,4 @@ typedef std::tuple_element<1, std::array>::type type; -// { dg-error "static assertion failed" "" { target *-*-* } 320 } +// { dg-error "static assertion failed" "" { target *-*-* } 322 }