From patchwork Sat Mar 1 20:30:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 325489 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A97102C0092 for ; Sun, 2 Mar 2014 07:30:59 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=t9Bm8rAv7BSP JyjF1MEQcui0tdQv4zwl8n93JawRDqxVYxB+eGOd9Ts7VWhjcPrdX+jn0ExLZORH rjsAp3oknqCXEBQjT+ujQ77K6ge/WqgtNMmR+Yepuxbq9de7fe17BJkBu4eo7vh7 Z/5t9o5afE4otTqxkFMrO8DNNvzdDkE= 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:from :to:cc:subject:date:message-id; s=default; bh=WI4GQDZE7fNLVB6NQU jibgD/n/A=; b=WjHR0wJcTDBHdGhQrEnbBZy6qO3F08MJk1l/uQHzPKg7UE/Bit e3Pqgwgc8pUG2HjiFYdxd5xx3Jt/MlCAPkyUM3Ra7y+Lx6O8dtv4PUh8p56jtZX1 ufum9pmxct9L6/5yu9GKSOn+QAgFDBlE2OGZXVPcjgcXDB0R1y2HrTe9w= Received: (qmail 24909 invoked by alias); 1 Mar 2014 20:30:52 -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 24893 invoked by uid 89); 1 Mar 2014 20:30:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_COUK, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-wi0-f176.google.com Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 01 Mar 2014 20:30:50 +0000 Received: by mail-wi0-f176.google.com with SMTP id hi5so1971804wib.3 for ; Sat, 01 Mar 2014 12:30:46 -0800 (PST) X-Received: by 10.180.19.138 with SMTP id f10mr8080467wie.11.1393705846820; Sat, 01 Mar 2014 12:30:46 -0800 (PST) Received: from xtorus.lan (munkyhouse.force9.co.uk. [84.92.244.81]) by mx.google.com with ESMTPSA id ay8sm10234167wjb.13.2014.03.01.12.30.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Mar 2014 12:30:46 -0800 (PST) From: Adam Butcher To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Volker Reichelt , Adam Butcher Subject: [PATCH] Fix PR c++/60377. Date: Sat, 1 Mar 2014 20:30:35 +0000 Message-Id: <1393705835-431-1-git-send-email-adam@jessamine.co.uk> PR c++/60377 * parser.c (cp_parser_parameter_declaration_clause): Unwind generic function scope on parse error in function parameter list. PR c++/60377 * g++.dg/cpp1y/pr60377.C: New testcase. --- gcc/cp/parser.c | 7 ++++++- gcc/testsuite/g++.dg/cpp1y/pr60377.C | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60377.C diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ef36327..8c78262 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18208,7 +18208,12 @@ cp_parser_parameter_declaration_clause (cp_parser* parser) parameter-declaration-list, then the entire parameter-declaration-clause is erroneous. */ if (is_error) - return NULL; + { + /* Unwind generic function template scope if necessary. */ + if (parser->fully_implicit_function_template_p) + finish_fully_implicit_template (parser, /*member_decl_opt=*/0); + return NULL; + } /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60377.C b/gcc/testsuite/g++.dg/cpp1y/pr60377.C new file mode 100644 index 0000000..4f6497c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60377.C @@ -0,0 +1,9 @@ +// PR c++/60377 +// { dg-options -std=c++1y } + +void foo(auto, void (f*)()); // { dg-error "expected" } + +struct A +{ + int i; +};