{
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;
return build_pointer_type (TREE_TYPE (type));
if (TREE_CODE (type) == FUNCTION_TYPE)
return build_pointer_type (type);
+ if (!MAYBE_CLASS_TYPE_P (type))
+ type = cv_unqualified (type);
return type;
}
/* Build an expression for `*((base*) &expr)'. */
expr = cp_build_unary_op (ADDR_EXPR, expr, 0, complain);
expr = convert_to_base (expr, build_pointer_type (totype),
- !c_cast_p, /*nonnull=*/true);
+ !c_cast_p, /*nonnull=*/true, complain);
expr = cp_build_indirect_ref (expr, RO_IMPLICIT_CONVERSION, complain);
return expr;
}
case ck_ptr:
if (convs->base_p)
expr = convert_to_base (expr, totype, !c_cast_p,
- /*nonnull=*/false);
+ /*nonnull=*/false, complain);
return build_nop (totype, expr);
case ck_pmem:
expr = convert_like_real (conv, expr, NULL_TREE, 0, 0,
/*issue_conversion_warnings=*/false,
c_cast_p,
- tf_warning_or_error);
+ complain);
/* Free all the conversions we allocated. */
obstack_free (&conversion_obstack, p);
expr = convert_to_base (expr,
build_pointer_type (base_conv_type),
/*check_access=*/true,
- /*nonnull=*/true);
+ /*nonnull=*/true, complain);
expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
}
else