{
unsigned HOST_WIDE_INT i = 0;
conversion *c;
- tree field = TYPE_FIELDS (type);
+ tree field = next_initializable_field (TYPE_FIELDS (type));
- for (; field; field = TREE_CHAIN (field), ++i)
+ for (; field; field = next_initializable_field (TREE_CHAIN (field)))
{
- if (TREE_CODE (field) != FIELD_DECL)
- continue;
if (i < CONSTRUCTOR_NELTS (ctor))
{
constructor_elt *ce = CONSTRUCTOR_ELT (ctor, i);
if (!can_convert_arg (TREE_TYPE (field), TREE_TYPE (ce->value),
ce->value, flags))
return NULL;
+ ++i;
+ if (TREE_CODE (type) == UNION_TYPE)
+ break;
}
else if (build_value_init (TREE_TYPE (field)) == error_mark_node)
return NULL;
}
+ if (i < CONSTRUCTOR_NELTS (ctor))
+ return NULL;
+
c = alloc_conversion (ck_aggr);
c->type = type;
c->rank = cr_exact;
for (fns = TREE_VALUE (conv_fns); fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
- tree first = first_arg;
if (DECL_NONCONVERTING_P (fn)
&& (flags & LOOKUP_ONLYCONVERTING))
continue;
- /* Lambdas have a static conversion op. */
- if (DECL_STATIC_FUNCTION_P (fn))
- first = NULL_TREE;
-
/* [over.match.funcs] For conversion functions, the function
is considered to be a member of the class of the implicit
object argument for the purpose of defining the type of
if (TREE_CODE (fn) == TEMPLATE_DECL)
cand = add_template_candidate (&candidates, fn, fromtype,
NULL_TREE,
- first, NULL, totype,
+ first_arg, NULL, totype,
TYPE_BINFO (fromtype),
conversion_path,
flags,
DEDUCE_CONV);
else
cand = add_function_candidate (&candidates, fn, fromtype,
- first, NULL,
+ first_arg, NULL,
TYPE_BINFO (fromtype),
conversion_path,
flags);
{
tree fn = OVL_CURRENT (fns);
- tree lfirst = first_mem_arg;
- if (DECL_STATIC_FUNCTION_P (fn))
- lfirst = NULL_TREE;
-
if (TREE_CODE (fn) == TEMPLATE_DECL)
add_template_candidate (&candidates, fn, base, NULL_TREE,
- lfirst, *args, NULL_TREE,
+ first_mem_arg, *args, NULL_TREE,
TYPE_BINFO (type),
TYPE_BINFO (type),
LOOKUP_NORMAL, DEDUCE_CALL);
else
add_function_candidate
- (&candidates, fn, base, lfirst, *args, TYPE_BINFO (type),
+ (&candidates, fn, base, first_mem_arg, *args, TYPE_BINFO (type),
TYPE_BINFO (type), LOOKUP_NORMAL);
}
}
- /* Rather than mess with handling static conversion ops here, just don't
- look at conversions in lambdas. */
- if (LAMBDA_TYPE_P (type))
- convs = NULL_TREE;
- else
- convs = lookup_conversions (type, /*lookup_template_convs_p=*/true);
+ convs = lookup_conversions (type, /*lookup_template_convs_p=*/true);
for (; convs; convs = TREE_CHAIN (convs))
{
if (expr == null_node && TREE_CODE (t) != BOOLEAN_TYPE && ARITHMETIC_TYPE_P (t))
{
if (fn)
- warning (OPT_Wconversion, "passing NULL to non-pointer argument %P of %qD",
- argnum, fn);
+ warning_at (input_location, OPT_Wconversion_null,
+ "passing NULL to non-pointer argument %P of %qD",
+ argnum, fn);
else
- warning (OPT_Wconversion, "converting to non-pointer type %qT from NULL", t);
+ warning_at (input_location, OPT_Wconversion_null,
+ "converting to non-pointer type %qT from NULL", t);
}
/* Issue warnings if "false" is converted to a NULL pointer */
else if (expr == boolean_false_node && fn && POINTER_TYPE_P (t))
- warning (OPT_Wconversion,
- "converting %<false%> to pointer type for argument %P of %qD",
- argnum, fn);
+ warning_at (input_location, OPT_Wconversion_null,
+ "converting %<false%> to pointer type for argument %P of %qD",
+ argnum, fn);
}
/* Perform the conversions in CONVS on the expression EXPR. FN and