From patchwork Mon Mar 24 21:33:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 333173 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 951151400AD for ; Tue, 25 Mar 2014 08:34:18 +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=MkobVGVvC6Kw LXts5jj+eg/vB+9LtPq36FX1AZzx0RqY290iNJZknPBwTNR7qNEerk43lT1U8uTz xugHB5tlQuB20C2eGXsq5PadoehKv8oK4ZrZvcOuEqGyu8UXjS4Tzs3l89sIIgIZ tY6RYDEChAZJ6tby/9FYXcBblGMhP3g= 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=griq+GXlFi1N6aWx3c QBXK1pr1I=; b=pjr0MPTd53wQUs0u7Hril0mOullmgAhzfKCoCH6EMjv/lnyJnm QgmMuutQGGNyv74YEs1ewvpOMG80g3NSpaxyRztVog9rGL+yWVmvu4x3NeKH7OxM esFSPPHtfoWQy0ditcqxQSUDmNqbGAV3RNwyT3H7G1zKbP6rXFbbupU7o= Received: (qmail 23549 invoked by alias); 24 Mar 2014 21:34:12 -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 23530 invoked by uid 89); 24 Mar 2014 21:34:11 -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-f178.google.com Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 24 Mar 2014 21:34:10 +0000 Received: by mail-wi0-f178.google.com with SMTP id bs8so4260wib.5 for ; Mon, 24 Mar 2014 14:34:07 -0700 (PDT) X-Received: by 10.180.78.200 with SMTP id d8mr18609149wix.34.1395696846885; Mon, 24 Mar 2014 14:34:06 -0700 (PDT) Received: from xtorus.lan (munkyhouse.force9.co.uk. [84.92.244.81]) by mx.google.com with ESMTPSA id pm2sm44054254wic.0.2014.03.24.14.34.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Mar 2014 14:34:05 -0700 (PDT) From: Adam Butcher To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Volker Reichelt , Adam Butcher Subject: [PATCH] Fix PR c++/60626 Date: Mon, 24 Mar 2014 21:33:57 +0000 Message-Id: <1395696837-908-1-git-send-email-adam@jessamine.co.uk> PR c++/60626 * parser.c (cp_parser_init_declarator): Handle erroneous generic type usage in non-functions with pushed scope. PR c++/60626 * g++.dg/cpp1y/pr60626.C: New testcase. --- gcc/cp/parser.c | 9 ++++++++- gcc/testsuite/g++.dg/cpp1y/pr60626.C | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60626.C diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index efb7b39..49fb731 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -16823,7 +16823,14 @@ cp_parser_init_declarator (cp_parser* parser, been issued. */ if (parser->fully_implicit_function_template_p) if (!function_declarator_p (declarator)) - finish_fully_implicit_template (parser, /*member_decl_opt=*/0); + { + if (pushed_scope) + { + pop_scope (pushed_scope); + pushed_scope = 0; + } + finish_fully_implicit_template (parser, /*member_decl_opt=*/0); + } /* For an in-class declaration, use `grokfield' to create the declaration. */ diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60626.C b/gcc/testsuite/g++.dg/cpp1y/pr60626.C new file mode 100644 index 0000000..39ea438 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60626.C @@ -0,0 +1,7 @@ +// PR c++/60626 +// { dg-do compile { target c++1y } } +// { dg-options "" } + +struct A {}; + +void (*A::p)(auto) = 0; // { dg-error "static member|non-template" }