Commit aa54df09 by Nathan Sidwell Committed by Nathan Sidwell

init.c (build_aggr_init): Reject bogus array initializers early.

	* init.c (build_aggr_init): Reject bogus array initializers
	early.

From-SVN: r35605
parent af657395
2000-08-10 Nathan Sidwell <nathan@codesourcery.com>
* init.c (build_aggr_init): Reject bogus array initializers
early.
2000-08-09 Nathan Sidwell <nathan@codesourcery.com> 2000-08-09 Nathan Sidwell <nathan@codesourcery.com>
* rtti.c (build_dynamic_cast_1): Set "C" linkage for new abi * rtti.c (build_dynamic_cast_1): Set "C" linkage for new abi
......
...@@ -1186,13 +1186,8 @@ build_aggr_init (exp, init, flags) ...@@ -1186,13 +1186,8 @@ build_aggr_init (exp, init, flags)
/* Must arrange to initialize each element of EXP /* Must arrange to initialize each element of EXP
from elements of INIT. */ from elements of INIT. */
tree itype = init ? TREE_TYPE (init) : NULL_TREE; tree itype = init ? TREE_TYPE (init) : NULL_TREE;
if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
{ if (init && !itype)
TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
if (init)
TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
}
if (init && TREE_TYPE (init) == NULL_TREE)
{ {
/* Handle bad initializers like: /* Handle bad initializers like:
class COMPLEX { class COMPLEX {
...@@ -1206,9 +1201,15 @@ build_aggr_init (exp, init, flags) ...@@ -1206,9 +1201,15 @@ build_aggr_init (exp, init, flags)
COMPLEX zees(1.0, 0.0)[10]; COMPLEX zees(1.0, 0.0)[10];
} }
*/ */
error ("bad array initializer"); cp_error ("bad array initializer");
return error_mark_node; return error_mark_node;
} }
if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
{
TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
if (init)
TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
}
stmt_expr = build_vec_init (exp, exp, array_type_nelts (type), init, stmt_expr = build_vec_init (exp, exp, array_type_nelts (type), init,
init && same_type_p (TREE_TYPE (init), init && same_type_p (TREE_TYPE (init),
TREE_TYPE (exp))); TREE_TYPE (exp)));
......
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