From patchwork Sun Mar 23 20:56:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 332928 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 EF5732C00CD for ; Mon, 24 Mar 2014 07:56:23 +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=Y2wpRHlmkysN BjtMxkdf0/Fyp9m1uqtcyxMWXBESDYudKMBxGAuWCcHD0BCYa8fa5JyTrFIM1cNz d7FZr06wzX2vdBJxO/tZ0IuS9wPp3K8zjC7A4/Dyxudl3z5U4zpQAaV1m4v2FKhC YiOtfqlhJzF9gCdKdnbuX+nDleH2rXA= 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=jo7gAzbIgQUqyVM+zR xedAntm0g=; b=MLsfOuohGU+D6x4I9uDOVl/4mDBgiq5thUxAtXHCK2IyuxxhXJ 01JBOoHo5cUbnEytd+ZgN0bY4X3JT6aXHMAPRfpIRRMmmekQ7e/6dU2/GP51mEs9 qAepz7mkZwjeVHJHN+85GeT7x6xBk/ETZftqDEuSv7PpfMdusKjzm761A= Received: (qmail 10156 invoked by alias); 23 Mar 2014 20:56:16 -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 10137 invoked by uid 89); 23 Mar 2014 20:56:14 -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-we0-f173.google.com Received: from mail-we0-f173.google.com (HELO mail-we0-f173.google.com) (74.125.82.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 23 Mar 2014 20:56:13 +0000 Received: by mail-we0-f173.google.com with SMTP id w61so2954338wes.32 for ; Sun, 23 Mar 2014 13:56:10 -0700 (PDT) X-Received: by 10.180.207.10 with SMTP id ls10mr11419888wic.22.1395608170464; Sun, 23 Mar 2014 13:56:10 -0700 (PDT) Received: from xtorus.lan (munkyhouse.force9.co.uk. [84.92.244.81]) by mx.google.com with ESMTPSA id uq2sm28273107wjc.5.2014.03.23.13.56.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Mar 2014 13:56:09 -0700 (PDT) From: Adam Butcher To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Volker Reichelt , Adam Butcher Subject: [PATCH] Fix PR c++/60627 Date: Sun, 23 Mar 2014 20:56:03 +0000 Message-Id: <1395608163-20514-1-git-send-email-adam@jessamine.co.uk> PR c++/60627 * parser.c (cp_parser_parameter_declaration_clause): Prevent 'auto' from introducing an implicit function template parameter within an explicit instantiation. PR c++/60627 * g++.dg/cpp1y/pr60627.C: New testcase. --- gcc/cp/parser.c | 4 +++- gcc/testsuite/g++.dg/cpp1y/pr60627.C | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr60627.C diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 36872c9..efb7b39 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -18207,7 +18207,9 @@ cp_parser_parameter_declaration_clause (cp_parser* parser) (void) cleanup; - if (!processing_specialization && !processing_template_parmlist) + if (!processing_specialization + && !processing_template_parmlist + && !processing_explicit_instantiation) if (!current_function_decl || (current_class_type && LAMBDA_TYPE_P (current_class_type))) parser->auto_is_implicit_function_template_parm_p = true; diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60627.C b/gcc/testsuite/g++.dg/cpp1y/pr60627.C new file mode 100644 index 0000000..9e2116e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr60627.C @@ -0,0 +1,12 @@ +// PR c++/60627 +// { dg-do compile { target c++1y } } +// { dg-options "" } + +template void foo(T) {} + +template void foo(auto); // { dg-error "auto|does not match" } + +void bar() +{ + foo(0); +}