From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 19:54:00 -0000 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) Content-Type: multipart/mixed; boundary="------------000805000509090104030405" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg00738.txt.bz2 This is a multi-part message in MIME format. --------------000805000509090104030405 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 253 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. --------------000805000509090104030405 Content-Type: text/x-patch; name="55232.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="55232.patch" Content-length: 1711 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 ); +} --------------000805000509090104030405--