PR c++/6477
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Apr 2002 15:11:36 +0000 (15:11 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Apr 2002 15:11:36 +0000 (15:11 +0000)
* decl.c (follow_tag_typedef): Check if TYPE_NAME (original) is
non-NULL first.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52900 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9ad6e11..8f92105 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 450bc39..9f03294 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 722263a..8c34771 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" }