From patchwork Fri Jan 6 15:26:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 90187 Delivered-To: patch@linaro.org Received: by 10.182.224.138 with SMTP id rc10csp380191obc; Fri, 6 Jan 2017 07:27:59 -0800 (PST) X-Received: by 10.99.37.195 with SMTP id l186mr140297774pgl.91.1483716479590; Fri, 06 Jan 2017 07:27:59 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t21si47487384plj.251.2017.01.06.07.27.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jan 2017 07:27:59 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445557-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445557-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445557-patch=linaro.org@gcc.gnu.org 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:in-reply-to; q=dns; s=default; b=hFDYj2s6wEa0XP15y Odnkwss/2U5dJoy4xMNGYCyS8+E0uaLWJ7AwVYxQZryMkK/CoW6pWlhIch8YOZ/x RyZczzHUg/4PuTBq3YvLlBrOpC/jRDbcZ1wPJkTnkQMAUW+7hAT/uDDkQI4obqTb nIE0tyG7XBdWVlWl8pOnDU0hdM= 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:in-reply-to; s=default; bh=YSx5k8Il5mkYGDl97ClGqyA /Dm8=; b=uo5FbYFrbz6MbAslLS+PyuVrEkjsuToDOtq2AyqlultyqQ56k1xOqD5 Yn2f7Bd7G7tZ2CQ1gjU0Z1f9gstDZ7f41mQbQXHCF0fCRikCNzcWOpniAfbOSyqO bXCzApZUnXGV6J6rPpgdN39DgZrhMm/hbKtJZVxQeCIDKGxIkKd8= Received: (qmail 70115 invoked by alias); 6 Jan 2017 15:26:41 -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 70017 invoked by uid 89); 6 Jan 2017 15:26:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Barrett, barrett, extreme 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; Fri, 06 Jan 2017 15:26:38 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47758C04D2AB; Fri, 6 Jan 2017 15:26:38 +0000 (UTC) Received: from localhost (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v06FQbe8005352; Fri, 6 Jan 2017 10:26:37 -0500 Date: Fri, 6 Jan 2017 15:26:36 +0000 From: Jonathan Wakely To: Barrett Adair Cc: Tim Shen , Daniel =?iso-8859-1?Q?Kr=FCgler?= , libstdc++ , gcc-patches@gcc.gnu.org Subject: Re: [Patch] [add changelog] reduce template instantiation depth in Message-ID: <20170106152636.GD2966@redhat.com> References: <20161115121751.GE3145@redhat.com> <20161206123541.GI6326@redhat.com> <20161223012052.GZ895@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161223012052.GZ895@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) On 23/12/16 01:20 +0000, Jonathan Wakely wrote: >On 22/12/16 19:06 -0600, Barrett Adair wrote: >>On Tue, Dec 6, 2016 at 1:24 PM, Tim Shen wrote: >>>On Tue, Dec 6, 2016 at 4:35 AM, Jonathan Wakely wrote: >>>>I've rebased Barrett's patch against the latest variant code >>>>(attached). >>>> >>>>Tim, do we want to make this change? A variant of 400 alternatives >>>>seems pretty extreme, but if we can support it without much trouble >>>>then maybe it's good to do so. >>>> >>> >>>Yes, go ahead. >>> >>>Thanks! >>> >>> >>>-- >>>Regards, >>>Tim Shen >> >>Did this make it into a branch? I'm not seeing this in the trunk. > >No, it hasn't been done yet. Here's what I've committed to trunk. Tested powerpc64le-linux. commit 0d54934b56a44b1c26510e98a57cd2663153f51c Author: Jonathan Wakely Date: Fri Jan 6 14:47:48 2017 +0000 Use fold expressions to reduce std::variant instantiation depth 2017-01-06 Barrett Adair Jonathan Wakely * include/std/variant (variant, swap): Replace __and_ usage with fold expressions. diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index 1803315..3d025a7 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -396,7 +396,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _Variant_base(_Variant_base&& __rhs) - noexcept(__and_...>::value) + noexcept((is_nothrow_move_constructible_v<_Types> && ...)) { if (__rhs._M_valid()) { @@ -459,8 +459,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Variant_base& operator=(_Variant_base&& __rhs) - noexcept(__and_..., - is_nothrow_move_assignable<_Types>...>::value) + noexcept((is_nothrow_move_constructible_v<_Types> && ...) + && (is_nothrow_move_assignable_v<_Types> && ...)) { if (this->_M_index == __rhs._M_index) { @@ -865,8 +865,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __lhs.swap(__rhs); } template - enable_if_t..., - is_swappable<_Types>...>::value> + enable_if_t && ...) + && (is_swappable_v<_Types> && ...))> swap(variant<_Types...>&, variant<_Types...>&) = delete; class bad_variant_access : public exception @@ -895,13 +895,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION is_default_constructible_v< variant_alternative_t<0, variant<_Types...>>>, variant<_Types...>>, private _Enable_copy_move< - __and_...>::value, - __and_..., - is_move_constructible<_Types>..., - is_copy_assignable<_Types>...>::value, - __and_...>::value, - __and_..., - is_move_assignable<_Types>...>::value, + (is_copy_constructible_v<_Types> && ...), + (is_copy_constructible_v<_Types> && ...) + && (is_move_constructible_v<_Types> && ...) + && (is_copy_assignable_v<_Types> && ...), + (is_move_constructible_v<_Types> && ...), + (is_move_constructible_v<_Types> && ...) + && (is_move_assignable_v<_Types> && ...), variant<_Types...>> { private: @@ -948,8 +948,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION noexcept(is_nothrow_default_constructible_v<__to_type<0>>) = default; variant(const variant&) = default; variant(variant&&) - noexcept(__and_< - is_nothrow_move_constructible<_Types>...>::value) = default; + noexcept((is_nothrow_move_constructible_v<_Types> && ...)) = default; template> @@ -1003,8 +1002,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION variant& operator=(const variant&) = default; variant& operator=(variant&&) - noexcept(__and_..., - is_nothrow_move_assignable<_Types>...>::value) = default; + noexcept((is_nothrow_move_constructible_v<_Types> && ...) + && (is_nothrow_move_assignable_v<_Types> && ...)) = default; template enable_if_t<__exactly_once<__accepted_type<_Tp&&>> @@ -1091,7 +1090,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void swap(variant& __rhs) - noexcept(__and_<__is_nothrow_swappable<_Types>...>::value + noexcept((__is_nothrow_swappable<_Types>::value && ...) && is_nothrow_move_constructible_v) { if (this->index() == __rhs.index())