diff mbox

[C++] PR 45665

Message ID 4C8F8BCF.2020304@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 14, 2010, 2:50 p.m. UTC
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.

Comments

Paolo Carlini Sept. 15, 2010, 8:43 a.m. UTC | #1
... I'm applying this as approved by Jason off-line.

Paolo.
diff mbox

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