re PR c++/6477 (Segfault on conflicting types in trivial code)
authorJakub Jelinek <jakub@redhat.com>
Mon, 29 Apr 2002 15:11:36 +0000 (17:11 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 29 Apr 2002 15:11:36 +0000 (17:11 +0200)
PR c++/6477
* decl.c (follow_tag_typedef): Check if TYPE_NAME (original) is
non-NULL first.

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

From-SVN: r52900

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/typedef1.C [new file with mode: 0644]

index 9ad6e11b049528c23444d226e5d040e23f39184a..8f9210500f31f7f206558b6526c188da3793e36c 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2002-04-29  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/6492
index 450bc3988a8093cbdb36efde8ee036a1f8c66398..9f03294c94a870a50d26c1843c419729c1a85928 100644 (file)
@@ -5332,6 +5332,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)))
index 722263a9d9909951886b0cb5d4c780074a5a3d07..8c3477199105319d87f05337b540691e0bf7b5d9 100644 (file)
@@ -1,3 +1,7 @@
+2002-04-29  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/parse/typedef1.C: New test.
+
 2002-04-29  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/6486
diff --git a/gcc/testsuite/g++.dg/parse/typedef1.C b/gcc/testsuite/g++.dg/parse/typedef1.C
new file mode 100644 (file)
index 0000000..5dbd16a
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/6477
+typedef struct A_ *A;  // { dg-error "previous declaration as" }
+typedef struct A B;    // { dg-error "conflicting types" }