FreeBSD/contrib/gcc/cp/typeck.c
/* Convert EXPR (an expression with pointer-to-member type) to TYPE
   (another pointer-to-member type in the same hierarchy) and return
   the converted expression.  If ALLOW_INVERSE_P is permitted, a
   pointer-to-derived may be converted to pointer-to-base; otherwise,
   only the other direction is permitted.  If C_CAST_P is true, this
   conversion is taking place as part of a C-style cast.  */
Convert EXPR (an expression with pointer-to-member type) to TYPE
(another pointer-to-member type in the same hierarchy) and return
the converted expression.  If ALLOW_INVERSE_P is permitted, a
pointer-to-derived may be converted to pointer-to-base; otherwise,
only the other direction is permitted.  If C_CAST_P is true, this
conversion is taking place as part of a C-style cast.
Convert EXPR ( an expression with pointer - to - member type ) to TYPE ( another pointer - to - member type in the same hierarchy ) and return the converted expression . If ALLOW_INVERSE_P is permitted a pointer - to - derived may be converted to pointer - to - base ; otherwise only the other direction is permitted . If C_CAST_P is true this conversion is taking place as part of a C - style cast .
tree
convert_ptrmem (tree type, tree expr, bool allow_inverse_p,
		bool c_cast_p)
{
  if (TYPE_PTRMEM_P (type))
    {
      tree delta;
      if (TREE_CODE (expr) == PTRMEM_CST)
	expr = cplus_expand_constant (expr);
      delta = get_delta_difference (TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (expr)),
				    TYPE_PTRMEM_CLASS_TYPE (type),
				    allow_inverse_p,
				    c_cast_p);
      if (!integer_zerop (delta))
	expr = cp_build_binary_op (PLUS_EXPR,
				   build_nop (ptrdiff_type_node, expr),
				   delta);
      return build_nop (type, expr);
    }
  else
    return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr,
			     allow_inverse_p, c_cast_p);
}
tree convert_ptrmem ( tree type , tree expr , bool allow_inverse_p , bool c_cast_p ) { if ( TYPE_PTRMEM_P ( type ) ) { tree delta ; if ( TREE_CODE ( expr ) == PTRMEM_CST ) expr = cplus_expand_constant ( expr ) ; delta = get_delta_difference ( TYPE_PTRMEM_CLASS_TYPE ( TREE_TYPE ( expr ) ) , TYPE_PTRMEM_CLASS_TYPE ( type ) , allow_inverse_p , c_cast_p ) ; if ( ! integer_zerop ( delta ) ) expr = cp_build_binary_op ( PLUS_EXPR , build_nop ( ptrdiff_type_node , expr ) , delta ) ; return build_nop ( type , expr ) ; } else return build_ptrmemfunc ( TYPE_PTRMEMFUNC_FN_TYPE ( type ) , expr , allow_inverse_p , c_cast_p ) ; }
Convert EXPR (an expression with pointer-to-member type) to TYPE
(another pointer-to-member type in the same hierarchy) and return
the converted expression.
Convert EXPR ( an expression with pointer - to - member type ) to TYPE ( another pointer - to - member type in the same hierarchy ) and return the converted expression .