From patchwork Wed Mar 6 16:24:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 225542 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]) by ozlabs.org (Postfix) with SMTP id 423E82C034F for ; Thu, 7 Mar 2013 03:25:04 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1363191904; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=6ymfV3+lk6wHFTftpymWO1rRm0o=; b=auzwHmdbJ7dSCDZpznTamOc42cruTm9lUlawjTiYq2dOVSYt8o1IkcaVebVNTY WGuX+i+T3xRaFQ0URVjDBvYclSYEXt07abznQmrzBa5qf1znx9s8ZrLAdF1ryTRy jw07eXqUyaDMhkSuUnnUF9F0O+orfzBftj88tcluQEVsQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=q8XrkfvfwKKg88uDrkqUOIXLO7GAwT8LvoaevSFvjxMuondMdfR4L7tefFdFEt nuiaRnNeQyINpBBlCeuRuslFNvaHh8v97bYSBmi4FwmmuNtU+yvSsfGA5gyWvb9n WF3bFEIstjeTM+ZAcENhcfzDewPwBrB1WJW3XQkiXxyHk=; Received: (qmail 7062 invoked by alias); 6 Mar 2013 16:24:49 -0000 Received: (qmail 7052 invoked by uid 22791); 6 Mar 2013 16:24:47 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL, BAYES_00, FSL_NEW_HELO_USER, KHOP_THREADED, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Mar 2013 16:24:38 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r26GOZml027420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 6 Mar 2013 16:24:36 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r26GOZwj004413 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 6 Mar 2013 16:24:35 GMT Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r26GOZFK000798; Wed, 6 Mar 2013 10:24:35 -0600 Received: from [192.168.1.4] (/79.33.221.85) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 06 Mar 2013 08:24:35 -0800 Message-ID: <51376DC1.4070604@oracle.com> Date: Wed, 06 Mar 2013 17:24:33 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch] PR 56534 References: <513629A1.3020000@oracle.com> <513753E9.4000309@redhat.com> In-Reply-To: <513753E9.4000309@redhat.com> X-IsSubscribed: yes 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 On 03/06/2013 03:34 PM, Jason Merrill wrote: > It sounds like the underlying problem is that "decl" isn't a > TYPE_DECL. So let's check for that instead. I see. Thus, also considering that the only other use of check_elaborated_type_specifier happens when the decl is known to be a TYPE_DECL, I thought we could change the caller, go back to something very similar to 4_6-branch + the call when appropriate. Passes testing. Thanks! Paolo. //////////////////// Index: cp/parser.c =================================================================== --- cp/parser.c (revision 196487) +++ cp/parser.c (working copy) @@ -14248,12 +14248,15 @@ cp_parser_elaborated_type_specifier (cp_parser* pa typename_type, /*complain=*/tf_error); /* If the `typename' keyword is in effect and DECL is not a type - decl. Then type is non existant. */ + decl, then type is non existent. */ else if (tag_type == typename_type && TREE_CODE (decl) != TYPE_DECL) type = NULL_TREE; - else - type = check_elaborated_type_specifier (tag_type, decl, + else if (TREE_CODE (decl) == TYPE_DECL) + type = check_elaborated_type_specifier (tag_type, decl, /*allow_template_p=*/true); + else + /* NULL_TREE or error_mark_node (if decl is error_mark_node). */ + type = TREE_TYPE (decl); } if (!type) Index: testsuite/g++.dg/template/crash115.C =================================================================== --- testsuite/g++.dg/template/crash115.C (revision 0) +++ testsuite/g++.dg/template/crash115.C (working copy) @@ -0,0 +1,3 @@ +// PR c++/56534 + +template < struct template rebind < > // { dg-error "expected" }