FreeBSD/contrib/gcc/cp/typeck.c
/* Returns nonzero if casting from TYPE1 to TYPE2 casts away
   constness.  */
Returns nonzero if casting from TYPE1 to TYPE2 casts away
constness.
Returns nonzero if casting from TYPE1 to TYPE2 casts away constness .
static bool
casts_away_constness (tree t1, tree t2)
{
  if (TREE_CODE (t2) == REFERENCE_TYPE)
    {
      t1 = (TREE_CODE (t1) == REFERENCE_TYPE ? TREE_TYPE (t1) : t1);
      return casts_away_constness (build_pointer_type (t1),
				   build_pointer_type (TREE_TYPE (t2)));
    }
  if (TYPE_PTRMEM_P (t1) && TYPE_PTRMEM_P (t2))
    return casts_away_constness
      (build_pointer_type (TYPE_PTRMEM_POINTED_TO_TYPE (t1)),
       build_pointer_type (TYPE_PTRMEM_POINTED_TO_TYPE (t2)));
  if (TREE_CODE (t1) != POINTER_TYPE
      || TREE_CODE (t2) != POINTER_TYPE)
    return false;
  t1 = TYPE_MAIN_VARIANT (t1);
  t2 = TYPE_MAIN_VARIANT (t2);
  casts_away_constness_r (&t1, &t2);
  if (!can_convert (t2, t1))
    return true;
  return false;
}
static bool casts_away_constness ( tree t1 , tree t2 ) { if ( TREE_CODE ( t2 ) == REFERENCE_TYPE ) { t1 = ( TREE_CODE ( t1 ) == REFERENCE_TYPE ? TREE_TYPE ( t1 ) : t1 ) ; return casts_away_constness ( build_pointer_type ( t1 ) , build_pointer_type ( TREE_TYPE ( t2 ) ) ) ; } if ( TYPE_PTRMEM_P ( t1 ) && TYPE_PTRMEM_P ( t2 ) ) return casts_away_constness ( build_pointer_type ( TYPE_PTRMEM_POINTED_TO_TYPE ( t1 ) ) , build_pointer_type ( TYPE_PTRMEM_POINTED_TO_TYPE ( t2 ) ) ) ; if ( TREE_CODE ( t1 ) != POINTER_TYPE || TREE_CODE ( t2 ) != POINTER_TYPE ) return false ; t1 = TYPE_MAIN_VARIANT ( t1 ) ; t2 = TYPE_MAIN_VARIANT ( t2 ) ; casts_away_constness_r ( & t1 , & t2 ) ; if ( ! can_convert ( t2 , t1 ) ) return true ; return false ; }
Returns nonzero if casting from TYPE1 to TYPE2 casts away
constness.
Returns nonzero if casting from TYPE1 to TYPE2 casts away constness .
/* [expr.const.cast]

	 Casting from an lvalue of type T1 to an lvalue of type T2
	 using a reference cast casts away constness if a cast from an
	 rvalue of type "pointer to T1" to the type "pointer to T2"
	 casts away constness.  */ /* [expr.const.cast]

       Casting from an rvalue of type "pointer to data member of X
       of type T1" to the type "pointer to data member of Y of type
       T2" casts away constness if a cast from an rvalue of type
       "pointer to T1" to the type "pointer to T2" casts away
       constness.  */ /* Casting away constness is only something that makes sense for
     pointer or reference types.  */ /* Top-level qualifiers don't matter.  */