From patchwork Mon Feb 7 13:26:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 82108 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 F0E4DB711B for ; Tue, 8 Feb 2011 00:26:17 +1100 (EST) Received: (qmail 21626 invoked by alias); 7 Feb 2011 13:26:16 -0000 Received: (qmail 21601 invoked by uid 22791); 7 Feb 2011 13:26:15 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Feb 2011 13:26:10 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p17DQ9ut030882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Feb 2011 08:26:09 -0500 Received: from adjoa.redhat.com (ovpn-113-77.phx2.redhat.com [10.3.113.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p17DQ6lw012022; Mon, 7 Feb 2011 08:26:08 -0500 From: Dodji Seketeli To: Jason Merrill Cc: GCC Patches Subject: Re: [PATCH] Fix PR c++/46394 References: <4D4D7C0E.9070402@redhat.com> X-URL: http://www.redhat.com Date: Mon, 07 Feb 2011 14:26:06 +0100 In-Reply-To: <4D4D7C0E.9070402@redhat.com> (Jason Merrill's message of "Sat, 05 Feb 2011 11:34:22 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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 Jason Merrill writes: > It seems to me that rather than try hard to make the pre-fixup parm > compare equal to the post-fixup parm, we could just drop the > same_type_p/cp_tree_equal check in tsubst_pack_expansion and clear > arg_pack if the argument is an expansion of *any* parameter pack. You mean by doing something like the snippet below? This is not precise enough as it results in tsubst_pack_expansion returning PACK_EXPANSION_* in some cases we don't want. E.g. when ordering template specializations; we substitute an implicit template argument [resulting from calling template_parm_to_arg called a parameter pack] of a template into a template parameter expansion of *another* template; tsubst_pack_expansion could then yield a PACK_EXPANSION_* instead of really performing the substitution. To do away with the same_type_p/cp_tree_equal completely as you suggest I think we'd need somehow to clear arg_pack if the argument is an expansion of any parameter pack /belonging to the same template as the expansion we are substituting into/. But then I am not sure how to express that at this point. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d59f32a..daf5e3e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8715,8 +8715,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, { tree expansion = TREE_VEC_ELT (ARGUMENT_PACK_ARGS (arg_pack), 0); tree pattern = PACK_EXPANSION_PATTERN (expansion); - if ((TYPE_P (pattern) && same_type_p (pattern, parm_pack)) - || (!TYPE_P (pattern) && cp_tree_equal (parm_pack, pattern))) + if (template_parameter_pack_p (pattern)) /* The argument pack that the parameter maps to is just an expansion of the parameter itself, such as one would find in the implicit typedef of a class inside the