From patchwork Thu May 9 16:42:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 242793 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 CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7992A2C00B5 for ; Fri, 10 May 2013 02:43:01 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=tfa06N80CKDDwR1IumlFa+LpIW/inrLwYIw1Ve8ijhPQAO S33ZkvqSaSKsIFGuxl6RiTpofEzASCV6xSgLecFY4ibGzygM9Kbjp7ZCMS9Joc+l 7CEH1qkWmcF0urVeGuqG1vI1Ep6YqWkAjun0kjX3XKygPD4w6sa/qliWnddWw= 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=qdHePil545y9MjcKAFBpOugjX9g=; b=LvixOyMZJGwytuF3AUfi ggWVcsSZpQOsB+5/1YeVXA2r51kuHxHlYRFMElnDqu12udNHGAp07GVf1m02t33X BEZdrIGLPB8EnfgRWx5EuMuQlhyAHKUM5AFETwhc5V2KjxTRXq+cveyDb0fjtvZD z6JmscuuYcIWR9k5olPMCbI= Received: (qmail 8615 invoked by alias); 9 May 2013 16:42:56 -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 8605 invoked by uid 89); 9 May 2013 16:42:55 -0000 X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 09 May 2013 16:42:55 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r49Ggsg9023827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 9 May 2013 12:42:54 -0400 Received: from [10.3.113.33] (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r49GgrD5021987 for ; Thu, 9 May 2013 12:42:53 -0400 Message-ID: <518BD20D.4070100@redhat.com> Date: Thu, 09 May 2013 12:42:53 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:22.0) Gecko/20100101 Thunderbird/22.0a2 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/57222 (bogus error with alias-template) X-Virus-Found: No lookup_template_class wasn't dealing properly with getting a TEMPLATE_DECL that represents a template template parameter. Tested x86_64-pc-linux-gnu, applying to trunk and 4.8. commit 7eed04dd8adeea6654e9275666586e52aef0b629 Author: Jason Merrill Date: Thu May 9 09:37:53 2013 -0400 PR c++/57222 * pt.c (lookup_template_class_1): Handle getting a template template parameter as D1. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2cb2abd..0747de6 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7016,7 +7016,7 @@ maybe_get_template_decl_from_type_decl (tree decl) ? CLASSTYPE_TI_TEMPLATE (TREE_TYPE (decl)) : decl; } -/* Given an IDENTIFIER_NODE (type TEMPLATE_DECL) and a chain of +/* Given an IDENTIFIER_NODE (or type TEMPLATE_DECL) and a chain of parameters, find the desired type. D1 is the PTYPENAME terminal, and ARGLIST is the list of arguments. @@ -7097,6 +7097,11 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, d1 = DECL_NAME (templ); context = DECL_CONTEXT (templ); } + else if (DECL_TEMPLATE_TEMPLATE_PARM_P (d1)) + { + templ = d1; + d1 = DECL_NAME (templ); + } /* Issue an error message if we didn't find a template. */ if (! templ) diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C new file mode 100644 index 0000000..4306ab7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-34.C @@ -0,0 +1,23 @@ +// PR c++/57222 +// { dg-require-effective-target c++11 } + +template