From 3a73bffb63125f29e0e6bb7925f5a8a510560aef Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 29 Apr 2002 17:11:36 +0200 Subject: [PATCH] re PR c++/6477 (Segfault on conflicting types in trivial code) 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 | 6 ++++++ gcc/cp/decl.c | 2 ++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/parse/typedef1.C | 3 +++ 4 files changed, 15 insertions(+) create mode 100644 gcc/testsuite/g++.dg/parse/typedef1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9ad6e11b049..8f9210500f3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2002-04-29 Jakub Jelinek + + PR c++/6477 + * decl.c (follow_tag_typedef): Check if TYPE_NAME (original) is + non-NULL first. + 2002-04-29 Mark Mitchell PR c++/6492 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 450bc3988a8..9f03294c94a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 722263a9d99..8c347719910 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-04-29 Jakub Jelinek + + * g++.dg/parse/typedef1.C: New test. + 2002-04-29 Mark Mitchell 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 index 00000000000..5dbd16a154f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/typedef1.C @@ -0,0 +1,3 @@ +// PR c++/6477 +typedef struct A_ *A; // { dg-error "previous declaration as" } +typedef struct A B; // { dg-error "conflicting types" } -- 2.30.2