[PATCH, c++]: Fix PR 53441, [4.8 Regression] obj-c++.dg/ivar-invalid-type-1.mm ICE

Uros Bizjak ubizjak@gmail.com
Mon May 21 21:41:00 GMT 2012


Hello!

As shown in the PR, ivar-invalid-type-1 ICEs in constructor_name_p,
due to accessor on NULL "type" argument.

The one-liner patch fixes the ICE by adding a guard that checks that
current_class_type is non-NULL before calling constructor_name_p.

2012-05-21  Uros Bizjak  <ubizjak@gmail.com>

	PR obj-c++/53441
	* decl.c (grokdeclarator): Check that current_class_type is non-NULL
	before calling constructor_name_p.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.

OK for mainline SVN?

Uros.
-------------- next part --------------
Index: decl.c
===================================================================
--- decl.c	(revision 187736)
+++ decl.c	(working copy)
@@ -9803,7 +9803,8 @@ grokdeclarator (const cp_declarator *declarator,
 	       clones.  */
 	    DECL_ABSTRACT (decl) = 1;
 	}
-      else if (constructor_name_p (unqualified_id, current_class_type))
+      else if (current_class_type
+	       && constructor_name_p (unqualified_id, current_class_type))
 	permerror (input_location, "ISO C++ forbids nested type %qD with same name "
 		   "as enclosing class",
 		   unqualified_id);


More information about the Gcc-patches mailing list