(C++) two more small fixes

Jason Merrill jason@cygnus.com
Fri Aug 6 18:22:00 GMT 1999


Caught by Perennial.

1999-08-06  Jason Merrill  <jason@yorick.cygnus.com>

	* decl.c (bad_specifiers): It's OK to have an EH spec on a function
	pointer.

	* pt.c (maybe_get_template_decl_from_type_decl): Make sure that
	we're looking at a class.

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.394
diff -c -p -r1.394 decl.c
*** decl.c	1999/08/07 01:01:50	1.394
--- decl.c	1999/08/07 01:21:08
*************** bad_specifiers (object, type, virtualp, 
*** 8362,8370 ****
      cp_error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration",
  	      object, type);
    if (friendp)
!     cp_error_at ("invalid friend declaration", object);
!   if (raises)
!     cp_error_at ("invalid exception specifications", object);
  }
  
  /* CTYPE is class type, or null if non-class.
--- 8362,8370 ----
      cp_error ("`const' and `volatile' function specifiers on `%D' invalid in %s declaration",
  	      object, type);
    if (friendp)
!     cp_error_at ("`%D' declared as a friend", object);
!   if (raises && ! TYPE_PTRFN_P (TREE_TYPE (object)))
!     cp_error_at ("`%D' declared with an exception specification", object);
  }
  
  /* CTYPE is class type, or null if non-class.
Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.320
diff -c -p -r1.320 pt.c
*** pt.c	1999/08/06 20:44:44	1.320
--- pt.c	1999/08/07 01:21:08
*************** maybe_get_template_decl_from_type_decl (
*** 3616,3621 ****
--- 3616,3622 ----
    return (decl != NULL_TREE
  	  && TREE_CODE (decl) == TYPE_DECL 
  	  && DECL_ARTIFICIAL (decl)
+ 	  && CLASS_TYPE_P (decl)
  	  && CLASSTYPE_TEMPLATE_INFO (TREE_TYPE (decl))) 
      ? CLASSTYPE_TI_TEMPLATE (TREE_TYPE (decl)) : decl;
  }


More information about the Gcc-patches mailing list