semantics.c (finish_switch_cond): Handle error cases gracefully.

* semantics.c (finish_switch_cond): Handle error cases gracefully.
        Detected by g++.law/enum5.C
        * typeck.c (build_modify_expr): Check for errors after resolving
        offsets. Detected by g++.brendan/static1.C
        * decl.c (complete_array_type): Ignore initial_value if it is an
        error. Detected by g++.benjamin/17930.C
        * typeck2.c (process_init_constructor): Return error if one argument
        is in error. Detected by g++.benjamin/13478.C

From-SVN: r25740
This commit is contained in:
Martin v. Löwis 1999-03-13 01:16:36 +00:00 committed by Martin v. Löwis
parent db7695ef3e
commit 0db982bee5
5 changed files with 30 additions and 1 deletions

View file

@ -1,3 +1,17 @@
1999-03-13 Martin von Löwis <loewis@informatik.hu-berlin.de>
* semantics.c (finish_switch_cond): Handle error cases gracefully.
Detected by g++.law/enum5.C
* typeck.c (build_modify_expr): Check for errors after resolving
offsets. Detected by g++.brendan/static1.C
* decl.c (complete_array_type): Ignore initial_value if it is an
error. Detected by g++.benjamin/17930.C
* typeck2.c (process_init_constructor): Return error if one argument
is in error. Detected by g++.benjamin/13478.C
1999-03-12 Martin von Löwis <loewis@informatik.hu-berlin.de>
* decl.c (select_decl): Allow class templates when we need types.

View file

@ -8259,6 +8259,8 @@ complete_array_type (type, initial_value, do_default)
/* Make an error message unless that happened already. */
if (initial_value != error_mark_node)
value = 1;
else
initial_value = NULL_TREE;
/* Prevent further error messages. */
maxindex = build_int_2 (0, 0);

View file

@ -490,12 +490,20 @@ finish_switch_cond (cond)
r = build_min_nt (SWITCH_STMT, cond, NULL_TREE);
add_tree (r);
}
else
else if (cond != error_mark_node)
{
emit_line_note (input_filename, lineno);
c_expand_start_case (cond);
r = NULL_TREE;
}
else
{
/* The code is in error, but we don't want expand_end_case to
crash. */
c_expand_start_case (boolean_false_node);
r = NULL_TREE;
}
push_switch ();
/* Don't let the tree nodes for COND be discarded by

View file

@ -5920,6 +5920,9 @@ build_modify_expr (lhs, modifycode, rhs)
olhstype = lhstype = TREE_TYPE (lhs);
}
if (lhs == error_mark_node)
return lhs;
if (TREE_CODE (lhstype) == REFERENCE_TYPE
&& modifycode != INIT_EXPR)
{

View file

@ -932,6 +932,8 @@ process_init_constructor (type, init, elts)
tree tail1 = tail;
next1 = digest_init (TREE_TYPE (type),
TREE_VALUE (tail), &tail1);
if (next1 == error_mark_node)
return next1;
my_friendly_assert
(same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type)),
TYPE_MAIN_VARIANT (TREE_TYPE (next1))),