From patchwork Mon Sep 23 06:53:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 277103 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5DAD22C00F9 for ; Mon, 23 Sep 2013 16:53:51 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:content-type:content-transfer-encoding:date:from :to:cc:subject:message-id; q=dns; s=default; b=KKntAcVFRQ3JalsKK XwJyUpjNQGMV5k+rYcIl+WMztKQz1USpb/QY088jKUzDAKS2RnlPQf700d0apzj4 DjbhBaanR1EO34upiD5Vwfb1/SUkoSVytCRKuk83WrVt6SaaqZoUtbVlaeEnF/mC dwnX09h6dBezfh4xNEybGo2tAw= 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 :mime-version:content-type:content-transfer-encoding:date:from :to:cc:subject:message-id; s=default; bh=/OiwgEqMwE3f1Vzza6jUaMS IlBQ=; b=hXPbIlfVaKVa58+5Yb0Lc+S2dLOGxHhw9vp1B0z/mURAJaO89m5RujJ 1EAEwYwnJwAAbwPnP7JcRMpscFyqnq7wC120KOQcgckOfrYooLfzpaftsi6JM4LQ +N5FQYcuu4ttVRKj+jo9QxAFUDMLotJpkoex2eE1O9/hOpfQE+dE= Received: (qmail 1622 invoked by alias); 23 Sep 2013 06:53:44 -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 1600 invoked by uid 89); 23 Sep 2013 06:53:43 -0000 Received: from avasout04.plus.net (HELO avasout04.plus.net) (212.159.14.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Sep 2013 06:53:43 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_SEMBLACK, RCVD_IN_SORBS_DUL, RDNS_NONE autolearn=no version=3.3.2 X-HELO: avasout04.plus.net Received: from webmail.plus.net ([84.93.237.98]) by avasout04 with smtp id UWte1m004283uBY01Wtgtw; Mon, 23 Sep 2013 07:53:40 +0100 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=MqNrtQqe c=1 sm=1 tr=0 a=BJaFPv9AyABFDM2hXLRoEA==:117 a=rJgRRbfb+UpHm5KwX9t5uQ==:17 a=0Bzu9jTXAAAA:8 a=EDeDkkTReK4A:10 a=dYCPD3cKDi0A:10 a=kqo3P2pFZ_QA:10 a=5LfTt-Tm1vgA:10 a=IkcTkHD0fZMA:10 a=ZBkl__CYAAAA:8 a=mrHjP8x4AAAA:8 a=7vtFykjVAAAA:8 a=rR6d-iXvo4YA:10 a=aFEOiDuIKbRF6U0kAb0A:9 a=QEXdDO2ut3YA:10 X-AUTH: jessaminenet+adam:2501 Received: from munkyhouse.force9.co.uk ([84.92.244.81]) by webmail.plus.net with HTTP (HTTP/1.1 POST); Mon, 23 Sep 2013 07:53:38 +0100 MIME-Version: 1.0 Date: Mon, 23 Sep 2013 07:53:38 +0100 From: Adam Butcher To: Jason Merrill Cc: Gcc Patches Subject: [C++1y] [Implicit Fix instantiation of implicit function template forward declarations. Message-ID: X-Sender: adam@jessamine.co.uk User-Agent: Roundcube Webmail/0.7.4 Hi Jason, I noticed that, although implicit function template declarations were accepted. They weren't setup correctly and didn't instantiate properly. The following patch fixes this by moving finish_fully_implicit_template to the end of cp_parser_init_declarator. OK to go with the others? Cheers, Adam Fix instantiation of implicit function template forward declarations. * parser.c (cp_parser_init_declarator): Defer calling finish_fully_implicit_template for forward declarations until after other decl processing is complete. Cleanup for clarity: Extract 'else' case after 'if' containing unconditional return. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 82abf7c..f3133f3 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -16318,8 +16318,7 @@ cp_parser_init_declarator (cp_parser* parser, "a function-definition is not allowed here"); return error_mark_node; } - else - { + location_t func_brace_location = cp_lexer_peek_token (parser->lexer)->location; @@ -16357,9 +16356,6 @@ cp_parser_init_declarator (cp_parser* parser, return decl; } } - else if (parser->fully_implicit_function_template_p) - decl = finish_fully_implicit_template (parser, decl); - } /* [dcl.dcl] @@ -16581,6 +16577,15 @@ cp_parser_init_declarator (cp_parser* parser, if (!friend_p && pushed_scope) pop_scope (pushed_scope); + if (function_declarator_p (declarator) + && parser->fully_implicit_function_template_p) + { + if (member_p) + decl = finish_fully_implicit_template (parser, decl); + else + finish_fully_implicit_template (parser, /*member_decl_opt=*/0); + } + return decl; }