Commit 25c8b645 by Jakub Jelinek Committed by Jakub Jelinek

re PR other/5746 (0220 cvs crashes using undeclared type)

	PR other/5746
	* semantics.c (finish_switch_cond): Don't call get_unwidened
	if error_mark_node.

From-SVN: r49969
parent 00c2f96f
2002-02-22 Jakub Jelinek <jakub@redhat.com>
PR other/5746
* semantics.c (finish_switch_cond): Don't call get_unwidened
if error_mark_node.
2002-02-22 Nathan Sidwell <nathan@codesourcery.com> 2002-02-22 Nathan Sidwell <nathan@codesourcery.com>
PR c++/2645, DR 295 PR c++/2645, DR 295
......
...@@ -516,7 +516,6 @@ finish_switch_cond (cond, switch_stmt) ...@@ -516,7 +516,6 @@ finish_switch_cond (cond, switch_stmt)
tree orig_type = NULL; tree orig_type = NULL;
if (!processing_template_decl) if (!processing_template_decl)
{ {
tree type;
tree index; tree index;
/* Convert the condition to an integer or enumeration type. */ /* Convert the condition to an integer or enumeration type. */
...@@ -533,7 +532,8 @@ finish_switch_cond (cond, switch_stmt) ...@@ -533,7 +532,8 @@ finish_switch_cond (cond, switch_stmt)
cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond)); cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond));
} }
type = TREE_TYPE (cond); if (cond != error_mark_node)
{
index = get_unwidened (cond, NULL_TREE); index = get_unwidened (cond, NULL_TREE);
/* We can't strip a conversion from a signed type to an unsigned, /* We can't strip a conversion from a signed type to an unsigned,
because if we did, int_fits_type_p would do the wrong thing because if we did, int_fits_type_p would do the wrong thing
...@@ -543,6 +543,7 @@ finish_switch_cond (cond, switch_stmt) ...@@ -543,6 +543,7 @@ finish_switch_cond (cond, switch_stmt)
== TREE_UNSIGNED (TREE_TYPE (index))) == TREE_UNSIGNED (TREE_TYPE (index)))
cond = index; cond = index;
} }
}
FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt)); FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
SWITCH_TYPE (switch_stmt) = orig_type; SWITCH_TYPE (switch_stmt) = orig_type;
push_switch (switch_stmt); push_switch (switch_stmt);
......
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