From patchwork Fri Mar 7 23:09:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 328117 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 B4E472C00BE for ; Sat, 8 Mar 2014 10:09:35 +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:in-reply-to:references; q=dns; s= default; b=S0Xoes4OjV82/rtfoEJCbo/AMheclUUQLokNCkxYf7bKb6pNIbsE5 1Mtlc9gXeYXhvOwpfFzuTVvboNKQ6nSptSFUv041fJLt3S3aepH+73HctAPQqaPj raNSbyZ8m3N5ojnSF2fjZ1Bwr0f7IqwCqrwAH6MpAPIeyc7b2ZhTDg= 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:in-reply-to:references; s= default; bh=oATkLHESi9a3va13y/f62Vlde70=; b=sFjy4RRn3rrEvF3DdgLa pH3+af5spvQLcrvKSelCXz/Fri1kqio0qANcucFfhRieHXGbJ2IEmVO/grgklQkv WItzKhpAxjNVnKaEWrk0esF4yJ5oKblzdI60Fe29tYap+/OOlPLu1+CDhtuzMmPL pAGx5jTgBsz1Pv04hp4LpwU= Received: (qmail 7465 invoked by alias); 7 Mar 2014 23:09:29 -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 7448 invoked by uid 89); 7 Mar 2014 23:09:28 -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-wg0-f50.google.com Received: from mail-wg0-f50.google.com (HELO mail-wg0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 07 Mar 2014 23:09:27 +0000 Received: by mail-wg0-f50.google.com with SMTP id x13so5951647wgg.21 for ; Fri, 07 Mar 2014 15:09:24 -0800 (PST) X-Received: by 10.180.12.43 with SMTP id v11mr635360wib.33.1394233764437; Fri, 07 Mar 2014 15:09:24 -0800 (PST) Received: from xtorus.lan (munkyhouse.force9.co.uk. [84.92.244.81]) by mx.google.com with ESMTPSA id r3sm16010469wjw.0.2014.03.07.15.09.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Mar 2014 15:09:23 -0800 (PST) From: Adam Butcher To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Volker Reichelt , Adam Butcher Subject: [PATCH] Fix PR c++/60393 Date: Fri, 7 Mar 2014 23:09:09 +0000 Message-Id: <1394233749-23758-1-git-send-email-adam@jessamine.co.uk> In-Reply-To: <531A250F.2050905@redhat.com> References: <531A250F.2050905@redhat.com> PR c++/60393 * parser.c (cp_parser_parameter_declaration_clause): Move generic function template unwinding on error into a more general location, ... (cp_parser_skip_to_end_of_statement): ... here. PR c++/60393 * g++.dg/cpp1y/pr60393.C: New testcase. --- gcc/cp/parser.c | 11 +++++------ gcc/testsuite/g++.dg/cpp1y/pr60393.C | 9 +++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60393.C diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8c78262..523a059 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3128,6 +3128,10 @@ cp_parser_skip_to_end_of_statement (cp_parser* parser) { unsigned nesting_depth = 0; + /* Unwind generic function template scope if necessary. */ + if (parser->fully_implicit_function_template_p) + finish_fully_implicit_template (parser, /*member_decl_opt=*/0); + while (true) { cp_token *token = cp_lexer_peek_token (parser->lexer); @@ -18208,12 +18212,7 @@ cp_parser_parameter_declaration_clause (cp_parser* parser) parameter-declaration-list, then the entire parameter-declaration-clause is erroneous. */ if (is_error) - { - /* 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; - } + return NULL; /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60393.C b/gcc/testsuite/g++.dg/cpp1y/pr60393.C new file mode 100644 index 0000000..38b8b91 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60393.C @@ -0,0 +1,9 @@ +// PR c++/60393 +// { dg-options -std=c++1y } + +void (*f)(auto) + 0; // { dg-error "expected" } + +struct A +{ + int i; +};