Commit c407792d by Richard Kenner

(build_delete): If the TYPE_DOMAIN is not set, give an error instead of core dumping.

(build_delete): If the TYPE_DOMAIN is not set, give an error instead
of core dumping.
(build_vec_delete): Resolve an offset ref before we try to use it.
(member_init_ok_or_else): Don't allow initialization of an ancestor's member
from within a constructor.

From-SVN: r10042
parent 75b0bbce
...@@ -840,8 +840,12 @@ member_init_ok_or_else (field, type, member_name) ...@@ -840,8 +840,12 @@ member_init_ok_or_else (field, type, member_name)
if (DECL_CONTEXT (field) != type if (DECL_CONTEXT (field) != type
&& TYPE_NEEDS_CONSTRUCTING (DECL_CONTEXT (field))) && TYPE_NEEDS_CONSTRUCTING (DECL_CONTEXT (field)))
{ {
cp_error ("member `%D' comes from base class needing constructor", if (current_function_decl && DECL_CONSTRUCTOR_P (current_function_decl))
field); cp_error ("initialization of `%D' inside constructor for `%T'",
field, type);
else
cp_error ("member `%D' comes from base class needing constructor",
field);
return 0; return 0;
} }
if (TREE_STATIC (field)) if (TREE_STATIC (field))
...@@ -3592,6 +3596,11 @@ build_delete (type, addr, auto_delete, flags, use_global_delete) ...@@ -3592,6 +3596,11 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
handle_array: handle_array:
if (TREE_SIDE_EFFECTS (addr)) if (TREE_SIDE_EFFECTS (addr))
addr = save_expr (addr); addr = save_expr (addr);
if (TYPE_DOMAIN (type) == NULL_TREE)
{
error ("unknown array size in delete");
return error_mark_node;
}
return build_vec_delete (addr, array_type_nelts (type), return build_vec_delete (addr, array_type_nelts (type),
c_sizeof_nowarn (TREE_TYPE (type)), c_sizeof_nowarn (TREE_TYPE (type)),
auto_delete, integer_two_node, auto_delete, integer_two_node,
...@@ -3932,9 +3941,8 @@ build_vec_delete (base, maxindex, elt_size, auto_delete_vec, auto_delete, ...@@ -3932,9 +3941,8 @@ build_vec_delete (base, maxindex, elt_size, auto_delete_vec, auto_delete,
tree auto_delete_vec, auto_delete; tree auto_delete_vec, auto_delete;
int use_global_delete; int use_global_delete;
{ {
tree ptype = TREE_TYPE (base); tree ptype, type, virtual_size;
tree type;
tree virtual_size;
/* Temporary variables used by the loop. */ /* Temporary variables used by the loop. */
tree tbase, size_exp, tbase_init; tree tbase, size_exp, tbase_init;
...@@ -3957,6 +3965,11 @@ build_vec_delete (base, maxindex, elt_size, auto_delete_vec, auto_delete, ...@@ -3957,6 +3965,11 @@ build_vec_delete (base, maxindex, elt_size, auto_delete_vec, auto_delete,
/* This is the BLOCK to record the symbol binding for debugging. */ /* This is the BLOCK to record the symbol binding for debugging. */
tree block; tree block;
if (TREE_CODE (base) == OFFSET_REF)
base = resolve_offset_ref (base);
ptype = TREE_TYPE (base);
base = stabilize_reference (base); base = stabilize_reference (base);
/* Since we can use base many times, save_expr it. */ /* Since we can use base many times, save_expr it. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment