From patchwork Thu Feb 14 19:53:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 220489 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 1BBB62C007B for ; Fri, 15 Feb 2013 06:54:12 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1361476453; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=jc2WzyP t2S3EKK2IqqzJKTVaoO0=; b=hjcZLMmGmNFjf55lcNe7Kl6wZ1gP4AbUzKwlhVG YCNuBZpVvXdw4OCawgRKAMeswD8VuzWZrc3b7zggy+tYdEyZQR39KM56p1Sos9mQ wlY8zIZmB9gbvBSGOfYKbsDUNI1KGgZ2r64qf7a4hALS7tIx+HU7aPEGCdqWEQyU jC24= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=nFlvKt6sGcpjgFa22I0ctMne9eZVlK85QIIgf8kQK9usGs8S6ZCzTrgr/iPWyH hfg6Ug5cRhRNGo6fwrPrrXVr54Sbs6wd0PvKevvBJe2Nlicj1wSydFU6D905PtId kVpk/j905JyJcfGFwOOUSmdE5ydiNb4ox5bd6HUrMo/co=; Received: (qmail 8201 invoked by alias); 14 Feb 2013 19:54:07 -0000 Received: (qmail 8191 invoked by uid 22791); 14 Feb 2013 19:54:06 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Thu, 14 Feb 2013 19:53:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1EJrp3P007647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Feb 2013 14:53:51 -0500 Received: from [10.3.113.52] (ovpn-113-52.phx2.redhat.com [10.3.113.52]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1EJrnkI020338 for ; Thu, 14 Feb 2013 14:53:50 -0500 Message-ID: <511D40CC.4020304@redhat.com> Date: Thu, 14 Feb 2013 14:53:48 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Thunderbird/21.0a1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/55232 (ICE on diagnostic in variadic template function) 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 We try to print typename types when dumping template bindings in order to be helpful. But we can't do that for typenames in pack expansions because we don't know which pack element we're interested in. Tested x86_64-pc-linux-gnu, applying to trunk. commit 91f6181cddda74ddfbae6e57454ab69659847928 Author: Jason Merrill Date: Thu Feb 14 09:13:54 2013 -0500 PR c++/55232 * error.c (find_typenames_r): Don't walk into a pack expansion. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index a4b3320..60119ec 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1283,7 +1283,7 @@ struct find_typenames_t }; static tree -find_typenames_r (tree *tp, int * /*walk_subtrees*/, void *data) +find_typenames_r (tree *tp, int *walk_subtrees, void *data) { struct find_typenames_t *d = (struct find_typenames_t *)data; tree mv = NULL_TREE; @@ -1296,6 +1296,14 @@ find_typenames_r (tree *tp, int * /*walk_subtrees*/, void *data) /* Add the typename without any cv-qualifiers. */ mv = TYPE_MAIN_VARIANT (*tp); + if (TREE_CODE (*tp) == TYPE_PACK_EXPANSION) + { + /* Don't mess with parameter packs since we don't remember + the pack expansion context for a particular typename. */ + *walk_subtrees = false; + return NULL_TREE; + } + if (mv && (mv == *tp || !pointer_set_insert (d->p_set, mv))) vec_safe_push (d->typenames, mv); diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-diag1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-diag1.C new file mode 100644 index 0000000..53182d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-diag1.C @@ -0,0 +1,22 @@ +// PR c++/55232 +// { dg-do compile { target c++11 } } + +struct vector +{ + typedef int value_type; +}; + +template< class U, class... T > +struct X +{ + void push_back( typename T::value_type ... vals ) + { + U::asoeuth; // { dg-error "" } + } +}; + +int main() +{ + X< int, vector > x; + x.push_back( 0 ); +}