FreeBSD/contrib/gcc/cp/call.c
/* Convert EXPR to TYPE (as a direct-initialization) if that is
   permitted.  If the conversion is valid, the converted expression is
   returned.  Otherwise, NULL_TREE is returned, except in the case
   that TYPE is a class type; in that case, an error is issued.  If
   C_CAST_P is true, then this direction initialization is taking
   place as part of a static_cast being attempted as part of a C-style
   cast.  */
Convert EXPR to TYPE (as a direct-initialization) if that is
permitted.  If the conversion is valid, the converted expression is
returned.  Otherwise, NULL_TREE is returned, except in the case
that TYPE is a class type; in that case, an error is issued.  If
C_CAST_P is true, then this direction initialization is taking
place as part of a static_cast being attempted as part of a C-style
cast.
Convert EXPR to TYPE ( as a direct - initialization ) if that is permitted . If the conversion is valid the converted expression is returned . Otherwise NULL_TREE is returned except in the case that TYPE is a class type ; in that case an error is issued . If C_CAST_P is true then this direction initialization is taking place as part of a static_cast being attempted as part of a C - style cast .
tree
perform_direct_initialization_if_possible (tree type,
					   tree expr,
					   bool c_cast_p)
{
  conversion *conv;
  void *p;
  if (type == error_mark_node || error_operand_p (expr))
    return error_mark_node;
  if (CLASS_TYPE_P (type))
    {
      expr = build_special_member_call (NULL_TREE, complete_ctor_identifier,
					build_tree_list (NULL_TREE, expr),
					type, LOOKUP_NORMAL);
      return build_cplus_new (type, expr);
    }
  p = conversion_obstack_alloc (0);
  conv = implicit_conversion (type, TREE_TYPE (expr), expr,
			      c_cast_p,
			      LOOKUP_NORMAL);
  if (!conv || conv->bad_p)
    expr = NULL_TREE;
  else
    expr = convert_like_real (conv, expr, NULL_TREE, 0, 0,
			      false,
			      c_cast_p);
  obstack_free (&conversion_obstack, p);
  return expr;
}
tree perform_direct_initialization_if_possible ( tree type , tree expr , bool c_cast_p ) { conversion * conv ; void * p ; if ( type == error_mark_node || error_operand_p ( expr ) ) return error_mark_node ; if ( CLASS_TYPE_P ( type ) ) { expr = build_special_member_call ( NULL_TREE , complete_ctor_identifier , build_tree_list ( NULL_TREE , expr ) , type , LOOKUP_NORMAL ) ; return build_cplus_new ( type , expr ) ; } p = conversion_obstack_alloc ( 0 ) ; conv = implicit_conversion ( type , TREE_TYPE ( expr ) , expr , c_cast_p , LOOKUP_NORMAL ) ; if ( ! conv || conv -> bad_p ) expr = NULL_TREE ; else expr = convert_like_real ( conv , expr , NULL_TREE , 0 , 0 , false , c_cast_p ) ; obstack_free ( & conversion_obstack , p ) ; return expr ; }
Convert EXPR to TYPE (as a direct-initialization) if that is
permitted.
Convert EXPR to TYPE ( as a direct - initialization ) if that is permitted .
/* [dcl.init]

     If the destination type is a (possibly cv-qualified) class type:

     -- If the initialization is direct-initialization ...,
     constructors are considered. ... If no constructor applies, or
     the overload resolution is ambiguous, the initialization is
     ill-formed.  */ /* Get the high-water mark for the CONVERSION_OBSTACK.  */ /*issue_conversion_warnings=*/ /* Free all the conversions we allocated.  */