From c827f22fb9b47c71259b389e1c61876f416d121a Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Mon, 27 Dec 2004 19:03:16 +0000 Subject: re PR c++/19149 (seg fault on invalid code) PR c++/19149 * decl.c (check_tag_decl): Robustify. PR c++/19149 * g++.dg/parse/error23.C: New test. From-SVN: r92648 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/error23.C | 7 +++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/parse/error23.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cf9a42c..a62a61e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-12-27 Mark Mitchell + + PR c++/19149 + * decl.c (check_tag_decl): Robustify. + 2004-12-23 Mark Mitchell PR c++/17595 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index be1addd..991996b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3514,7 +3514,8 @@ check_tag_decl (cp_decl_specifier_seq *declspecs) return NULL_TREE; } - if (TYPE_P (declspecs->type) + if (declspecs->type + && TYPE_P (declspecs->type) && ((TREE_CODE (declspecs->type) != TYPENAME_TYPE && IS_AGGR_TYPE (declspecs->type)) || TREE_CODE (declspecs->type) == ENUMERAL_TYPE)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff08406..1b81b83 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-12-27 Mark Mitchell + + PR c++/19149 + * g++.dg/parse/error23.C: New test. + 2004-12-27 Tobias Schlueter * gfortran.dg/g77/f90-intrinsic-bit.f: New. diff --git a/gcc/testsuite/g++.dg/parse/error23.C b/gcc/testsuite/g++.dg/parse/error23.C new file mode 100644 index 0000000..7d6fda2 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error23.C @@ -0,0 +1,7 @@ +// PR c++/19149 + +struct QChar { + QChar( char c ); + QChar( const QChar& c ); + static const ; // { dg-error "" } +}; -- cgit v1.1