From patchwork Mon Aug 30 16:38:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 63078 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 0103EB7111 for ; Tue, 31 Aug 2010 02:38:51 +1000 (EST) Received: (qmail 10011 invoked by alias); 30 Aug 2010 16:38:48 -0000 Received: (qmail 9998 invoked by uid 22791); 30 Aug 2010 16:38:47 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from vsmtp1.tin.it (HELO vsmtp1.tin.it) (212.216.176.141) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Aug 2010 16:38:40 +0000 Received: from [192.168.0.4] (79.50.51.186) by vsmtp1.tin.it (8.0.022) id 4B9917F00FBA06FE; Mon, 30 Aug 2010 18:38:37 +0200 Message-ID: <4C7BDE8D.8040907@oracle.com> Date: Mon, 30 Aug 2010 18:38:37 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 45043 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 Hi, I have this very simple fix for an ICE on invalid. Tested x86_64-linux. Ok for mainline? Paolo. /////////////////////////// /cp 2010-08-30 Paolo Carlini PR c++/45043 * decl.c (grokdeclarator): Use MAIN_NAME_P only on IDENTIFIER_NODEs. /testsuite 2010-08-30 Paolo Carlini PR c++/45043 * g++.dg/template/crash102.C: New. Index: testsuite/g++.dg/template/crash102.C =================================================================== --- testsuite/g++.dg/template/crash102.C (revision 0) +++ testsuite/g++.dg/template/crash102.C (revision 0) @@ -0,0 +1,5 @@ +// PR c++/45043 + +template < typename > class A; +template < typename T > A < T >::B::~B () // { dg-error "type" } +{} Index: cp/decl.c =================================================================== --- cp/decl.c (revision 163647) +++ cp/decl.c (working copy) @@ -8115,7 +8115,8 @@ grokdeclarator (const cp_declarator *declarator, common. With no options, it is allowed. With -Wreturn-type, it is a warning. It is only an error with -pedantic-errors. */ is_main = (funcdef_flag - && dname && MAIN_NAME_P (dname) + && dname && TREE_CODE (dname) == IDENTIFIER_NODE + && MAIN_NAME_P (dname) && ctype == NULL_TREE && in_namespace == NULL_TREE && current_namespace == global_namespace);