[PATCH] Fix PR c++/6477 (regression from 3.0.x)

Jakub Jelinek jakub@redhat.com
Mon Apr 29 02:16:00 GMT 2002


Hi!

Richards recent patch introduced an ICE for code, which is illegal,
though I think may happen from time to time.
Below is a fix, bootstrapped on i386-redhat-linux with no regressions.
Ok to commit? Ok for branch?

2002-04-29  Jakub Jelinek  <jakub@redhat.com>

	PR c++/6477
	* decl.c (follow_tag_typedef): Check if TYPE_NAME (original) is
	non-NULL first.

	* g++.dg/parse/typedef1.C: New test.

--- gcc/cp/decl.c.jj	Fri Apr 26 13:42:01 2002
+++ gcc/cp/decl.c	Sun Apr 28 23:21:09 2002
@@ -5336,6 +5337,8 @@ follow_tag_typedef (type)
   tree original;
 
   original = original_type (type);
+  if (! TYPE_NAME (original))
+    return NULL_TREE;
   if (TYPE_IDENTIFIER (original) == TYPE_IDENTIFIER (type)
       && (CP_DECL_CONTEXT (TYPE_NAME (original))
 	  == CP_DECL_CONTEXT (TYPE_NAME (type)))
--- gcc/testsuite/g++.dg/parse/typedef1.C.jj	Sun Apr 28 23:21:17 2002
+++ gcc/testsuite/g++.dg/parse/typedef1.C	Mon Apr 29 11:14:30 2002
@@ -0,0 +1,3 @@
+// PR c++/6477
+typedef struct A_ *A;	// { dg-error "previous declaration as" }
+typedef struct A B;	// { dg-error "conflicting types" }

	Jakub



More information about the Gcc-patches mailing list