Patchwork [C++] PR 45665

login
register
mail settings
Submitter Paolo Carlini
Date Sept. 14, 2010, 2:50 p.m.
Message ID <4C8F8BCF.2020304@oracle.com>
Download mbox | patch
Permalink /patch/64706/
State New
Headers show

Comments

Paolo Carlini - Sept. 14, 2010, 2:50 p.m.
Hi,

I have this simple patch for an ICE on invalid. Tested x86_64-linux.

Is it ok for mainline?

Thanks,
Paolo.

//////////////////
/cp
2010-09-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/45665
	* decl.c (grokdeclarator): Check build_memfn_type return value
	for error_mark_node.

/testsuite
2010-09-14  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/45665
	* testsuite/g++.dg/template/crash103.C: New.
Paolo Carlini - Sept. 15, 2010, 8:43 a.m.
... I'm applying this as approved by Jason off-line.

Paolo.

Patch

Index: testsuite/g++.dg/template/crash103.C
===================================================================
--- testsuite/g++.dg/template/crash103.C	(revision 0)
+++ testsuite/g++.dg/template/crash103.C	(revision 0)
@@ -0,0 +1,4 @@ 
+// PR c++/45665
+
+template < typename > struct S;
+void (S <0>::*ptr) (); // { dg-error "type" }
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 164279)
+++ cp/decl.c	(working copy)
@@ -8762,6 +8762,8 @@  grokdeclarator (const cp_declarator *declarator,
 	      type = build_memfn_type (type,
 				       declarator->u.pointer.class_type,
 				       memfn_quals);
+	      if (type == error_mark_node)
+		return error_mark_node;
 	      memfn_quals = TYPE_UNQUALIFIED;
 	    }