FreeBSD/contrib/gcc/cp/decl.c
/* Check that it's OK to declare a function with the indicated TYPE.
   SFK indicates the kind of special function (if any) that this
   function is.  OPTYPE is the type given in a conversion operator
   declaration, or the class type for a constructor/destructor.
   Returns the actual return type of the function; that
   may be different than TYPE if an error occurs, or for certain
   special functions.  */
Check that it's OK to declare a function with the indicated TYPE.
SFK indicates the kind of special function (if any) that this
function is.  OPTYPE is the type given in a conversion operator
declaration, or the class type for a constructor/destructor.
Returns the actual return type of the function; that
may be different than TYPE if an error occurs, or for certain
special functions.
Check that it ' s OK to declare a function with the indicated TYPE . SFK indicates the kind of special function ( if any ) that this function is . OPTYPE is the type given in a conversion operator declaration or the class type for a constructor / destructor . Returns the actual return type of the function ; that may be different than TYPE if an error occurs or for certain special functions .
static tree
check_special_function_return_type (special_function_kind sfk,
				    tree type,
				    tree optype)
{
  switch (sfk)
    {
    case sfk_constructor:
      if (type)
	error ("return type specification for constructor invalid");
      if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (optype))
	type = build_pointer_type (optype);
      else
	type = void_type_node;
      break;
    case sfk_destructor:
      if (type)
	error ("return type specification for destructor invalid");
      if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (optype))
	type = build_pointer_type (void_type_node);
      else
	type = void_type_node;
      break;
    case sfk_conversion:
      if (type && !same_type_p (type, optype))
	error ("operator %qT declared to return %qT", optype, type);
      else if (type)
	pedwarn ("return type specified for %<operator %T%>",  optype);
      type = optype;
      break;
    default:
      gcc_unreachable ();
    }
  return type;
}
static tree check_special_function_return_type ( special_function_kind sfk , tree type , tree optype ) { switch ( sfk ) { case sfk_constructor : if ( type ) error ( " " ) ; if ( targetm . cxx . cdtor_returns_this ( ) && ! TYPE_FOR_JAVA ( optype ) ) type = build_pointer_type ( optype ) ; else type = void_type_node ; break ; case sfk_destructor : if ( type ) error ( " " ) ; if ( targetm . cxx . cdtor_returns_this ( ) && ! TYPE_FOR_JAVA ( optype ) ) type = build_pointer_type ( void_type_node ) ; else type = void_type_node ; break ; case sfk_conversion : if ( type && ! same_type_p ( type , optype ) ) error ( " " , optype , type ) ; else if ( type ) pedwarn ( " " , optype ) ; type = optype ; break ; default : gcc_unreachable ( ) ; } return type ; }
Check that it's OK to declare a function with the indicated TYPE.
Check that it ' s OK to declare a function with the indicated TYPE .
/* We can't use the proper return type here because we run into
	 problems with ambiguous bases and covariant returns.
	 Java classes are left unchanged because (void *) isn't a valid
	 Java type, and we don't want to change the Java ABI.  */