From patchwork Wed Nov 9 22:21:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 124728 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 07CFCB6F7B for ; Thu, 10 Nov 2011 09:21:44 +1100 (EST) Received: (qmail 31773 invoked by alias); 9 Nov 2011 22:21:39 -0000 Received: (qmail 31764 invoked by uid 22791); 9 Nov 2011 22:21:37 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_TM 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; Wed, 09 Nov 2011 22:21:20 +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 pA9MLJK2006485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Nov 2011 17:21:20 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pA9MLItg025701 for ; Wed, 9 Nov 2011 17:21:19 -0500 Received: from [0.0.0.0] (ovpn-113-127.phx2.redhat.com [10.3.113.127]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id pA9MLHP3027181 for ; Wed, 9 Nov 2011 17:21:18 -0500 Message-ID: <4EBAFCDD.90604@redhat.com> Date: Wed, 09 Nov 2011 17:21:17 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111001 Thunderbird/7.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/51046 (ICE with unexpanded parameter pack) 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 Missing a call to check_for_bare_parameter_packs. Tested x86_64-pc-linux-gnu, applying to trunk. commit 3d2892d25a37984099611c02614fc9788e14d4c4 Author: Jason Merrill Date: Wed Nov 9 14:25:21 2011 -0500 PR c++/51046 * parser.c (cp_parser_range_for): check_for_bare_parameter_packs. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 3cb6dbf..fc8f3c8 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9292,6 +9292,8 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl) at instantiation. If not, it is done just ahead. */ if (processing_template_decl) { + if (check_for_bare_parameter_packs (range_expr)) + range_expr = error_mark_node; stmt = begin_range_for_stmt (scope, init); finish_range_for_decl (stmt, range_decl, range_expr); if (!type_dependent_expression_p (range_expr) diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic119.C b/gcc/testsuite/g++.dg/cpp0x/variadic119.C new file mode 100644 index 0000000..78cd23e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic119.C @@ -0,0 +1,13 @@ +// PR c++/51046 +// { dg-do compile { target c++11 } } + +template +void f() +{ + for (int i : IS); // { dg-error "not expanded" } +} + +int main() +{ + f<0, 1, 2>(); +}