diff mbox

[C++] PR 45043

Message ID 4C7BDE8D.8040907@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Aug. 30, 2010, 4:38 p.m. UTC
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  <paolo.carlini@oracle.com>

	PR c++/45043
	* decl.c (grokdeclarator): Use MAIN_NAME_P only on IDENTIFIER_NODEs.

/testsuite
2010-08-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/45043
	* g++.dg/template/crash102.C: New.

Comments

Jason Merrill Aug. 30, 2010, 6:09 p.m. UTC | #1
ok.

Jason
diff mbox

Patch

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);