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 to bad_specifiers


A fairly trivial patch to allow an exception-specifier on a
reference-to-function.  Test in g++.dg/eh/spec1.C.

Tested i686-pc-linux-gnu.

2001-12-04  Jason Merrill  <jason@redhat.com>

	* cp-tree.h (TYPE_REFFN_P): New macro.
	* decl.c (bad_specifiers): Check it, too.

*** ./gcc/cp/decl.c.~1~	Tue Dec  4 02:38:19 2001
--- ./gcc/cp/decl.c	Tue Dec  4 14:21:05 2001
*************** bad_specifiers (object, type, virtualp, 
*** 8766,8771 ****
--- 8766,8772 ----
    if (raises
        && (TREE_CODE (object) == TYPE_DECL
  	  || (!TYPE_PTRFN_P (TREE_TYPE (object))
+ 	      && !TYPE_REFFN_P (TREE_TYPE (object))
  	      && !TYPE_PTRMEMFUNC_P (TREE_TYPE (object)))))
      cp_error_at ("`%D' declared with an exception specification", object);
  }
*** ./gcc/cp/cp-tree.h.~1~	Fri Nov 30 14:05:56 2001
--- ./gcc/cp/cp-tree.h	Tue Dec  4 16:12:41 2001
*************** extern int flag_new_for_scope;
*** 2487,2492 ****
--- 2487,2495 ----
  #define TYPE_PTRFN_P(NODE)				\
    (TREE_CODE (NODE) == POINTER_TYPE			\
     && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
+ #define TYPE_REFFN_P(NODE)				\
+   (TREE_CODE (NODE) == REFERENCE_TYPE			\
+    && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
  
  /* Nonzero for _TYPE node means that this type is a pointer to member
     function type.  */

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