unsigned ix;
tree fn;
- inform (input_location, "%J because the following virtual functions are pure "
- "within %qT:", TYPE_MAIN_DECL (type), type);
+ inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)),
+ " because the following virtual functions are pure within %qT:",
+ type);
for (ix = 0; VEC_iterate (tree, pure, ix, fn); ix++)
inform (input_location, "\t%+#D", fn);
VEC_truncate (tree, pure, 0);
}
else
- inform (input_location, "%J since type %qT has pure virtual functions",
- TYPE_MAIN_DECL (type), type);
+ inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (type)),
+ " since type %qT has pure virtual functions",
+ type);
return 1;
}
NULL_TREE);
code = build2 (INIT_EXPR, inner_type, sub, value);
- code = build_stmt (EXPR_STMT, code);
+ code = build_stmt (input_location, EXPR_STMT, code);
add_stmt (code);
continue;
}
tree cons = copy_node (init);
CONSTRUCTOR_ELTS (init) = NULL;
code = build2 (MODIFY_EXPR, type, dest, cons);
- code = build_stmt (EXPR_STMT, code);
+ code = build_stmt (input_location, EXPR_STMT, code);
add_stmt (code);
}
break;
for static variable. In that case, caller must emit the code. */
tree
-store_init_value (tree decl, tree init)
+store_init_value (tree decl, tree init, int flags)
{
tree value, type;
/* End of special C++ code. */
/* Digest the specified initializer into an expression. */
- value = digest_init (type, init);
+ value = digest_init_flags (type, init, flags);
/* If the initializer is not a constant, fill in DECL_INITIAL with
the bits that are constant, and then return an expression that
will perform the dynamic initialization. */
NESTED is true iff we are being called for an element of a CONSTRUCTOR. */
static tree
-digest_init_r (tree type, tree init, bool nested)
+digest_init_r (tree type, tree init, bool nested, int flags)
{
enum tree_code code = TREE_CODE (type);
if (cxx_dialect != cxx98 && nested)
check_narrowing (type, init);
- init = convert_for_initialization (0, type, init, LOOKUP_NORMAL,
+ init = convert_for_initialization (0, type, init, flags,
"initialization", NULL_TREE, 0,
- tf_warning_or_error);
+ tf_warning_or_error);
exp = &init;
/* Skip any conversions since we'll be outputting the underlying
}
return convert_for_initialization (NULL_TREE, type, init,
- LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING,
+ flags,
"initialization", NULL_TREE, 0,
tf_warning_or_error);
}
tree
digest_init (tree type, tree init)
{
- return digest_init_r (type, init, false);
+ return digest_init_r (type, init, false, LOOKUP_IMPLICIT);
+}
+
+tree
+digest_init_flags (tree type, tree init, int flags)
+{
+ return digest_init_r (type, init, false, flags);
}
\f
/* Set of flags used within process_init_constructor to describe the
/* Vectors are like simple fixed-size arrays. */
len = TYPE_VECTOR_SUBPARTS (type);
- /* There cannot be more initializers than needed as otherwise
- reshape_init would have already rejected the initializer. */
- if (!unbounded)
- gcc_assert (VEC_length (constructor_elt, v) <= len);
+ /* There must not be more initializers than needed. */
+ if (!unbounded && VEC_length (constructor_elt, v) > len)
+ error ("too many initializers for %qT", type);
for (i = 0; VEC_iterate (constructor_elt, v, i, ce); ++i)
{
else
ce->index = size_int (i);
gcc_assert (ce->value);
- ce->value = digest_init_r (TREE_TYPE (type), ce->value, true);
+ ce->value = digest_init_r (TREE_TYPE (type), ce->value, true, LOOKUP_IMPLICIT);
if (ce->value != error_mark_node)
gcc_assert (same_type_ignoring_top_level_qualifiers_p
}
gcc_assert (ce->value);
- next = digest_init_r (type, ce->value, true);
+ next = digest_init_r (type, ce->value, true, LOOKUP_IMPLICIT);
++idx;
}
else if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (field)))
else
next = build_constructor (init_list_type_node, NULL);
- next = digest_init_r (TREE_TYPE (field), next, true);
+ next = digest_init_r (TREE_TYPE (field), next, true, LOOKUP_IMPLICIT);
/* Warn when some struct elements are implicitly initialized. */
warning (OPT_Wmissing_field_initializers,
}
if (ce->value && ce->value != error_mark_node)
- ce->value = digest_init_r (TREE_TYPE (ce->index), ce->value, true);
+ ce->value = digest_init_r (TREE_TYPE (ce->index), ce->value, true, LOOKUP_IMPLICIT);
return picflag_from_initializer (ce->value);
}
/* The type to which we are casting. */
tree type;
+ VEC(tree,gc) *parmvec;
if (exp == error_mark_node || parms == error_mark_node)
return error_mark_node;
}
/* Call the constructor. */
- exp = build_special_member_call (NULL_TREE, complete_ctor_identifier, parms,
- type, LOOKUP_NORMAL, complain);
+ parmvec = make_tree_vector ();
+ for (; parms != NULL_TREE; parms = TREE_CHAIN (parms))
+ VEC_safe_push (tree, gc, parmvec, TREE_VALUE (parms));
+ exp = build_special_member_call (NULL_TREE, complete_ctor_identifier,
+ &parmvec, type, LOOKUP_NORMAL, complain);
+ release_tree_vector (parmvec);
if (exp == error_mark_node)
return error_mark_node;