From patchwork Tue Mar 17 17:38:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 451078 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 1E16E14018C for ; Wed, 18 Mar 2015 04:38:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=CEioIPQe; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=BtzdfCoQs/6yD4P4f/PkTlojBqDycMNULVI3foYD72OFUI TmWM7xY5hO3qKnYMs3rKCwCp9Y/pEQOO4eiXYL5KCetl+9EtPnj6Q7uecb518Hlb oaAG3mj1bf9zlgHla8xq7zvs6+6fzhgq4cZm1DpJHJAI/3PYA7pQRHaJcbdzg= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=l1ZFtzedReoS9AByxAGBrGR95Ys=; b=CEioIPQeaKHRm5yGjkSN zdBfPyx/K24hXz+DJJ9w56qLJ7CI+CuMOLfVv1Vg2mZQ80h/wDDzN638NezFPW37 wgS/9DuuPn6B6TwNlz1i7cKWtDNZxhFGf+SR/9AkhfRM5fP3KquRzbu74lZ8juS5 q6dvyN0l6ONHnqefdWdnYG4= Received: (qmail 99587 invoked by alias); 17 Mar 2015 17:38:20 -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 99577 invoked by uid 89); 17 Mar 2015 17:38:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Mar 2015 17:38:09 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2HHc8Cc004324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Mar 2015 13:38:08 -0400 Received: from [10.10.116.17] ([10.10.116.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2HHc7RQ017541 for ; Tue, 17 Mar 2015 13:38:08 -0400 Message-ID: <5508667C.2080501@redhat.com> Date: Tue, 17 Mar 2015 13:38:04 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/65061 (using-declaration of template) By the time we get to the lower have of cp_parser_template_name, we don't need to keep the USING_DECL around, we can strip it away and just deal with the underlying template. Tested x86_64-pc-linux-gnu, applying to trunk. commit 0c6a93e343cbd6ce5c5c341b65eca721b58dae46 Author: Jason Merrill Date: Mon Mar 16 09:40:04 2015 -0400 PR c++/65061 * parser.c (cp_parser_template_name): Call strip_using_decl. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a209ee6..a18f38c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14051,6 +14051,8 @@ cp_parser_template_name (cp_parser* parser, /*ambiguous_decls=*/NULL, token->location); + decl = strip_using_decl (decl); + /* If DECL is a template, then the name was a template-name. */ if (TREE_CODE (decl) == TEMPLATE_DECL) { diff --git a/gcc/testsuite/g++.dg/inherit/using8.C b/gcc/testsuite/g++.dg/inherit/using8.C new file mode 100644 index 0000000..b7677c8 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/using8.C @@ -0,0 +1,15 @@ +// PR c++/65061 + +struct B +{ + template + struct S {}; +}; + +struct D : B +{ + using B::S; + + template + void doIt(/*struct*/ S&); +};