FreeBSD/contrib/gcc/cp/typeck.c
/* Return an expression representing static_cast<TYPE>(EXPR).  */
Return an expression representing static_cast(EXPR).
Return an expression representing static_cast ( EXPR ) .
tree
build_static_cast (tree type, tree expr)
{
  tree result;
  bool valid_p;
  if (type == error_mark_node || expr == error_mark_node)
    return error_mark_node;
  if (processing_template_decl)
    {
      expr = build_min (STATIC_CAST_EXPR, type, expr);
      TREE_SIDE_EFFECTS (expr) = 1;
      return convert_from_reference (expr);
    }
  if (TREE_CODE (type) != REFERENCE_TYPE
      && TREE_CODE (expr) == NOP_EXPR
      && TREE_TYPE (expr) == TREE_TYPE (TREE_OPERAND (expr, 0)))
    expr = TREE_OPERAND (expr, 0);
  result = build_static_cast_1 (type, expr, false, &valid_p);
  if (valid_p)
    return result;
  error ("invalid static_cast from type %qT to type %qT",
	 TREE_TYPE (expr), type);
  return error_mark_node;
}
tree build_static_cast ( tree type , tree expr ) { tree result ; bool valid_p ; if ( type == error_mark_node || expr == error_mark_node ) return error_mark_node ; if ( processing_template_decl ) { expr = build_min ( STATIC_CAST_EXPR , type , expr ) ; TREE_SIDE_EFFECTS ( expr ) = 1 ; return convert_from_reference ( expr ) ; } if ( TREE_CODE ( type ) != REFERENCE_TYPE && TREE_CODE ( expr ) == NOP_EXPR && TREE_TYPE ( expr ) == TREE_TYPE ( TREE_OPERAND ( expr , 0 ) ) ) expr = TREE_OPERAND ( expr , 0 ) ; result = build_static_cast_1 ( type , expr , false , & valid_p ) ; if ( valid_p ) return result ; error ( " " , TREE_TYPE ( expr ) , type ) ; return error_mark_node ; }
Return an expression representing static_cast<TYPE>(EXPR).
Return an expression representing static_cast<TYPE > ( EXPR ) .
/* We don't know if it will or will not have side effects.  */ /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
     Strip such NOP_EXPRs if VALUE is being used in non-lvalue context.  */ /*c_cast_p=*/