re PR c++/18729 (ICE on invalid typedef)

cp:
	PR c++/18729
	* parser.c (cp_parser_class_name): Check decl's type is not
	error_mark_node.
testsuite:
	PR C++/18729
	* g++.dg/parse/crash20.C: New.

From-SVN: r91566
This commit is contained in:
Nathan Sidwell 2004-12-01 16:37:32 +00:00 committed by Nathan Sidwell
parent f8e7ffa673
commit 07c65e005e
4 changed files with 22 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2004-12-01 Nathan Sidwell <nathan@codesourcery.com>
PR c++/18729
* parser.c (cp_parser_class_name): Check decl's type is not
error_mark_node.
PR c++/17431
* call.c (standard_conversion): Add FLAGS parameter. Do not allow
derived to base conversion when checking constructor

View File

@ -12232,6 +12232,7 @@ cp_parser_class_name (cp_parser *parser,
decl = TYPE_NAME (make_typename_type (scope, decl, tag_type, tf_error));
else if (decl == error_mark_node
|| TREE_CODE (decl) != TYPE_DECL
|| TREE_TYPE (decl) == error_mark_node
|| !IS_AGGR_TYPE (TREE_TYPE (decl)))
{
cp_parser_error (parser, "expected class-name");

View File

@ -1,5 +1,8 @@
2004-12-01 Nathan Sidwell <nathan@codesourcery.com>
PR C++/18729
* g++.dg/parse/crash20.C: New.
PR c++/17431
* g++.dg/overload/arg1.C: New.
* g++.dg/overload/arg2.C: New.

View File

@ -0,0 +1,14 @@
// { dg-do compile }
// Copyright (C) 2004 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 Dec 2004 <nathan@codesourcery.com>
// PR 18729: ICE on ill formed
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
template<typename T> struct A
{
typedef typename T::X Y; // { dg-error "not a class" "" }
};
A<int>::Y y; // { dg-error "instantiated from here" "" }