FreeBSD/contrib/gcc/cp/call.c
/* Create an overload candidate for the conversion function FN which will
   be invoked for expression OBJ, producing a pointer-to-function which
   will in turn be called with the argument list ARGLIST, and add it to
   CANDIDATES.  FLAGS is passed on to implicit_conversion.

   Actually, we don't really care about FN; we care about the type it
   converts to.  There may be multiple conversion functions that will
   convert to that type, and we rely on build_user_type_conversion_1 to
   choose the best one; so when we create our candidate, we record the type
   instead of the function.  */
Create an overload candidate for the conversion function FN which will
be invoked for expression OBJ, producing a pointer-to-function which
will in turn be called with the argument list ARGLIST, and add it to
CANDIDATES.  FLAGS is passed on to implicit_conversion.

Actually, we don't really care about FN; we care about the type it
converts to.  There may be multiple conversion functions that will
convert to that type, and we rely on build_user_type_conversion_1 to
choose the best one; so when we create our candidate, we record the type
instead of the function.
Create an overload candidate for the conversion function FN which will be invoked for expression OBJ producing a pointer - to - function which will in turn be called with the argument list ARGLIST and add it to CANDIDATES . FLAGS is passed on to implicit_conversion . Actually we don ' t really care about FN ; we care about the type it converts to . There may be multiple conversion functions that will convert to that type and we rely on build_user_type_conversion_1 to choose the best one ; so when we create our candidate we record the type instead of the function .
static struct z_candidate *
add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
		    tree arglist, tree access_path, tree conversion_path)
{
  tree totype = TREE_TYPE (TREE_TYPE (fn));
  int i, len, viable, flags;
  tree parmlist, parmnode, argnode;
  conversion **convs;
  for (parmlist = totype; TREE_CODE (parmlist) != FUNCTION_TYPE; )
    parmlist = TREE_TYPE (parmlist);
  parmlist = TYPE_ARG_TYPES (parmlist);
  len = list_length (arglist) + 1;
  convs = alloc_conversions (len);
  parmnode = parmlist;
  argnode = arglist;
  viable = 1;
  flags = LOOKUP_NORMAL;
  if (*candidates && (*candidates)->fn == totype)
    return NULL;
  for (i = 0; i < len; ++i)
    {
      tree arg = i == 0 ? obj : TREE_VALUE (argnode);
      tree argtype = lvalue_type (arg);
      conversion *t;
      if (i == 0)
	t = implicit_conversion (totype, argtype, arg, false,
				 flags);
      else if (parmnode == void_list_node)
	break;
      else if (parmnode)
	t = implicit_conversion (TREE_VALUE (parmnode), argtype, arg,
				 false, flags);
      else
	{
	  t = build_identity_conv (argtype, arg);
	  t->ellipsis_p = true;
	}
      convs[i] = t;
      if (! t)
	break;
      if (t->bad_p)
	viable = -1;
      if (i == 0)
	continue;
      if (parmnode)
	parmnode = TREE_CHAIN (parmnode);
      argnode = TREE_CHAIN (argnode);
    }
  if (i < len)
    viable = 0;
  if (!sufficient_parms_p (parmnode))
    viable = 0;
  return add_candidate (candidates, totype, arglist, len, convs,
			access_path, conversion_path, viable);
}
static struct z_candidate * add_conv_candidate ( struct z_candidate * * candidates , tree fn , tree obj , tree arglist , tree access_path , tree conversion_path ) { tree totype = TREE_TYPE ( TREE_TYPE ( fn ) ) ; int i , len , viable , flags ; tree parmlist , parmnode , argnode ; conversion * * convs ; for ( parmlist = totype ; TREE_CODE ( parmlist ) != FUNCTION_TYPE ; ) parmlist = TREE_TYPE ( parmlist ) ; parmlist = TYPE_ARG_TYPES ( parmlist ) ; len = list_length ( arglist ) + 1 ; convs = alloc_conversions ( len ) ; parmnode = parmlist ; argnode = arglist ; viable = 1 ; flags = LOOKUP_NORMAL ; if ( * candidates && ( * candidates ) -> fn == totype ) return NULL ; for ( i = 0 ; i < len ; ++ i ) { tree arg = i == 0 ? obj : TREE_VALUE ( argnode ) ; tree argtype = lvalue_type ( arg ) ; conversion * t ; if ( i == 0 ) t = implicit_conversion ( totype , argtype , arg , false , flags ) ; else if ( parmnode == void_list_node ) break ; else if ( parmnode ) t = implicit_conversion ( TREE_VALUE ( parmnode ) , argtype , arg , false , flags ) ; else { t = build_identity_conv ( argtype , arg ) ; t -> ellipsis_p = true ; } convs [ i ] = t ; if ( ! t ) break ; if ( t -> bad_p ) viable = -1 ; if ( i == 0 ) continue ; if ( parmnode ) parmnode = TREE_CHAIN ( parmnode ) ; argnode = TREE_CHAIN ( argnode ) ; } if ( i < len ) viable = 0 ; if ( ! sufficient_parms_p ( parmnode ) ) viable = 0 ; return add_candidate ( candidates , totype , arglist , len , convs , access_path , conversion_path , viable ) ; }
Create an overload candidate for the conversion function FN which will
be invoked for expression OBJ, producing a pointer-to-function which
will in turn be called with the argument list ARGLIST, and add it to
CANDIDATES.
Create an overload candidate for the conversion function FN which will be invoked for expression OBJ producing a pointer - to - function which will in turn be called with the argument list ARGLIST and add it to CANDIDATES .
/* Don't bother looking up the same type twice.  */ /*c_cast_p=*/ /*c_cast_p=*/