(C++) patch to fix some ices

Jason Merrill jason@cygnus.com
Thu Feb 11 00:00:00 GMT 1999


1999-02-10  Jason Merrill  <jason@yorick.cygnus.com>

	* decl.c (grokdeclarator): Catch wierd declarators.
	* decl2.c (finish_file): Don't abort because of namespace parsing
	failure.
	(check_decl_namespace): Remove.

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.306
diff -c -p -r1.306 decl.c
*** decl.c	1999/02/05 02:42:48	1.306
--- decl.c	1999/02/11 07:59:27
*************** grokdeclarator (declarator, declspecs, d
*** 10574,10579 ****
--- 10574,10593 ----
  	}
      }
  
+   if (declarator == NULL_TREE
+       || TREE_CODE (declarator) == IDENTIFIER_NODE
+       || (TREE_CODE (declarator) == TEMPLATE_ID_EXPR
+ 	  && (TREE_CODE (type) == FUNCTION_TYPE
+ 	      || TREE_CODE (type) == METHOD_TYPE)))
+     /* OK */;
+   else if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
+     {
+       cp_error ("template-id `%D' used as a declarator", declarator);
+       declarator = dname;
+     }
+   else
+     my_friendly_abort (990210);
+ 
    if (RIDBIT_SETP (RID_TYPEDEF, specbits) && decl_context != TYPENAME)
      {
        tree decl;
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.180
diff -c -p -r1.180 decl2.c
*** decl2.c	1999/02/07 15:44:08	1.180
--- decl2.c	1999/02/11 07:59:28
*************** static int is_namespace_ancestor PROTO((
*** 58,64 ****
  static void add_using_namespace PROTO((tree, tree, int));
  static tree ambiguous_decl PROTO((tree, tree, tree,int));
  static tree build_anon_union_vars PROTO((tree, tree*, int, int));
- static void check_decl_namespace PROTO((void));
  
  extern int current_class_depth;
  
--- 58,63 ----
*************** finish_file ()
*** 3228,3238 ****
    at_eof = 1;
  
    /* Bad parse errors.  Just forget about it.  */
!   if (! global_bindings_p () || current_class_type)
      return;
  
-   check_decl_namespace ();
- 
    start_time = get_run_time ();
  
    /* Otherwise, GDB can get confused, because in only knows
--- 3227,3235 ----
    at_eof = 1;
  
    /* Bad parse errors.  Just forget about it.  */
!   if (! global_bindings_p () || current_class_type || decl_namespace_list)
      return;
  
    start_time = get_run_time ();
  
    /* Otherwise, GDB can get confused, because in only knows
*************** void
*** 4286,4297 ****
  pop_decl_namespace ()
  {
    decl_namespace_list = TREE_CHAIN (decl_namespace_list);
- }
- 
- static void 
- check_decl_namespace ()
- {
-   my_friendly_assert (decl_namespace_list == NULL_TREE, 980711);
  }
  
  /* Enter a class or namespace scope. */
--- 4283,4288 ----


More information about the Gcc-patches mailing list