FreeBSD/contrib/gcc/cp/decl.c
/* D is a constructor or overloaded `operator='.

   Let T be the class in which D is declared. Then, this function
   returns:

   -1 if D's is an ill-formed constructor or copy assignment operator
      whose first parameter is of type `T'.
   0  if D is not a copy constructor or copy assignment
      operator.
   1  if D is a copy constructor or copy assignment operator whose
      first parameter is a reference to const qualified T.
   2  if D is a copy constructor or copy assignment operator whose
      first parameter is a reference to non-const qualified T.

   This function can be used as a predicate. Positive values indicate
   a copy constructor and nonzero values indicate a copy assignment
   operator.  */
D is a constructor or overloaded `operator='.
Let T be the class in which D is declared. Then, this function
returns.

1 if D's is an ill-formed constructor or copy assignment operator
whose first parameter is of type `T'.
0  if D is not a copy constructor or copy assignment
operator.
1  if D is a copy constructor or copy assignment operator whose
first parameter is a reference to const qualified T.
2  if D is a copy constructor or copy assignment operator whose
first parameter is a reference to non-const qualified T.

This function can be used as a predicate. Positive values indicate
a copy constructor and nonzero values indicate a copy assignment
operator.
D is a constructor or overloaded ` operator = ' . Let T be the class in which D is declared . Then this function returns . 1 if D ' s is an ill - formed constructor or copy assignment operator whose first parameter is of type ` T ' . 0 if D is not a copy constructor or copy assignment operator . 1 if D is a copy constructor or copy assignment operator whose first parameter is a reference to const qualified T . 2 if D is a copy constructor or copy assignment operator whose first parameter is a reference to non - const qualified T . This function can be used as a predicate . Positive values indicate a copy constructor and nonzero values indicate a copy assignment operator .
int
copy_fn_p (tree d)
{
  tree args;
  tree arg_type;
  int result = 1;
  gcc_assert (DECL_FUNCTION_MEMBER_P (d));
  if (TREE_CODE (d) == TEMPLATE_DECL
      || (DECL_TEMPLATE_INFO (d)
	  && DECL_MEMBER_TEMPLATE_P (DECL_TI_TEMPLATE (d))))
    return 0;
  args = FUNCTION_FIRST_USER_PARMTYPE (d);
  if (!args)
    return 0;
  arg_type = TREE_VALUE (args);
  if (arg_type == error_mark_node)
    return 0;
  if (TYPE_MAIN_VARIANT (arg_type) == DECL_CONTEXT (d))
    {
      result = -1;
    }
  else if (TREE_CODE (arg_type) == REFERENCE_TYPE
	   && TYPE_MAIN_VARIANT (TREE_TYPE (arg_type)) == DECL_CONTEXT (d))
    {
      if (CP_TYPE_CONST_P (TREE_TYPE (arg_type)))
	result = 2;
    }
  else
    return 0;
  args = TREE_CHAIN (args);
  if (args && args != void_list_node && !TREE_PURPOSE (args))
    return 0;
  return result;
}
int copy_fn_p ( tree d ) { tree args ; tree arg_type ; int result = 1 ; gcc_assert ( DECL_FUNCTION_MEMBER_P ( d ) ) ; if ( TREE_CODE ( d ) == TEMPLATE_DECL || ( DECL_TEMPLATE_INFO ( d ) && DECL_MEMBER_TEMPLATE_P ( DECL_TI_TEMPLATE ( d ) ) ) ) return 0 ; args = FUNCTION_FIRST_USER_PARMTYPE ( d ) ; if ( ! args ) return 0 ; arg_type = TREE_VALUE ( args ) ; if ( arg_type == error_mark_node ) return 0 ; if ( TYPE_MAIN_VARIANT ( arg_type ) == DECL_CONTEXT ( d ) ) { result = -1 ; } else if ( TREE_CODE ( arg_type ) == REFERENCE_TYPE && TYPE_MAIN_VARIANT ( TREE_TYPE ( arg_type ) ) == DECL_CONTEXT ( d ) ) { if ( CP_TYPE_CONST_P ( TREE_TYPE ( arg_type ) ) ) result = 2 ; } else return 0 ; args = TREE_CHAIN ( args ) ; if ( args && args != void_list_node && ! TREE_PURPOSE ( args ) ) return 0 ; return result ; }
D is a constructor or overloaded `operator='.
D is a constructor or overloaded ` operator = ' .
/* Instantiations of template member functions are never copy
       functions.  Note that member functions of templated classes are
       represented as template functions internally, and we must
       accept those as copy functions.  */ /* Pass by value copy assignment operator.  */ /* There are more non-optional args.  */