This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] Fix 18729 ICE


This fixes 18729, a newly introduced ice-on-invalid.  We create typedefs
with an error_mark_node type, and because we don't have distinct
error_type, error_decl, error_expr nodes, we have to explicitly check
for it.

booted & tested on i686-pc-linux-gnu

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

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.

Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.285
diff -c -3 -p -r1.285 parser.c
*** cp/parser.c	30 Nov 2004 15:07:39 -0000	1.285
--- cp/parser.c	1 Dec 2004 16:32:32 -0000
*************** cp_parser_class_name (cp_parser *parser,
*** 12232,12237 ****
--- 12232,12238 ----
      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");
// { 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" "" }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]