From patchwork Wed Mar 19 17:19:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 331801 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 51DC02C00A1 for ; Thu, 20 Mar 2014 04:20:15 +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 :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=GZKSrPDlrXUMmIOmv7xS4EVaE76bwgHJAS0/koxHZPM lHqkogLbbfSBRntTY6NCFAtD2nVlmFwI1O/H3snepfja66dQpnfaBogn+1ri7GuO hIr8CbAmkLkXGpLPasmsC4Ae2BnK/UuTYQPCjdbjj9ZONVXLrUtN+V6wCaMvZvYk = 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:cc:subject:content-type; s=default; bh=Fa8XTitCOJa4WrhflEwwCnkt/Xo=; b=Dp+0nowfeUOcRk197 WWLcGTIz0WQkqrdU3Y0Rhdl9GOtsEJtvNe7X8+ilUESjtflucgXzFRcAH8KjQa/j 5zy/RTBpte2TY2JFBhFdlATQ1luIH+lHlP/a5EOJlbZeGAo0+rwFGlPSEiIT3IID iSU1gCS3TIu8fkxYR5EULZMjQg= Received: (qmail 15314 invoked by alias); 19 Mar 2014 17:20:08 -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 15300 invoked by uid 89); 19 Mar 2014 17:20:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 19 Mar 2014 17:20:07 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2JHK42c013561 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Mar 2014 17:20:05 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2JHK3B0003812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Mar 2014 17:20:04 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2JHK319003803; Wed, 19 Mar 2014 17:20:03 GMT Received: from [192.168.1.4] (/79.33.222.186) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Mar 2014 10:20:03 -0700 Message-ID: <5329D18A.2070305@oracle.com> Date: Wed, 19 Mar 2014 18:19:06 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 60384 X-IsSubscribed: yes Hi, in this minor regression we ICE during error recovery, when push_class_level_binding_1 (called by finish_member_declaration via pushdecl_class_level) gets a TEMPLATE_ID_EXPR as the name argument. It's a regression because, since r199779, invalid declarations get more often through (with TREE_TYPE an error_mark_node, like TREE_TYPE (x) in the case at issue). Thus the additional check I'm suggesting. Tested x86_64-linux. Thanks, Paolo. ////////////////////// /cp 2014-03-19 Paolo Carlini PR c++/60384 * name-lookup.c (push_class_level_binding_1): Check identifier_p on the name argument. /testsuite 2014-03-19 Paolo Carlini PR c++/60384 * g++.dg/cpp1y/pr60384.C: New. Index: cp/name-lookup.c =================================================================== --- cp/name-lookup.c (revision 208682) +++ cp/name-lookup.c (working copy) @@ -3112,7 +3112,9 @@ push_class_level_binding_1 (tree name, tree x) if (!class_binding_level) return true; - if (name == error_mark_node) + if (name == error_mark_node + /* Can happen for an erroneous declaration (c++/60384). */ + || !identifier_p (name)) return false; /* Check for invalid member names. But don't worry about a default Index: testsuite/g++.dg/cpp1y/pr60384.C =================================================================== --- testsuite/g++.dg/cpp1y/pr60384.C (revision 0) +++ testsuite/g++.dg/cpp1y/pr60384.C (working copy) @@ -0,0 +1,9 @@ +// PR c++/60384 +// { dg-do compile { target c++1y } } + +template int foo(); + +struct A +{ + typedef auto foo<>(); // { dg-error "typedef declared 'auto'" } +};