tree orig_type = NULL;
if (!processing_template_decl)
{
- tree type;
tree index;
/* Convert the condition to an integer or enumeration type. */
cond = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (cond), cond));
}
- type = TREE_TYPE (cond);
- index = get_unwidened (cond, NULL_TREE);
- /* 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
- when checking case values for being in range,
- and it's too hard to do the right thing. */
- if (TREE_UNSIGNED (TREE_TYPE (cond))
- == TREE_UNSIGNED (TREE_TYPE (index)))
- cond = index;
+ if (cond != error_mark_node)
+ {
+ index = get_unwidened (cond, NULL_TREE);
+ /* 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
+ when checking case values for being in range,
+ and it's too hard to do the right thing. */
+ if (TREE_UNSIGNED (TREE_TYPE (cond))
+ == TREE_UNSIGNED (TREE_TYPE (index)))
+ cond = index;
+ }
}
FINISH_COND (cond, switch_stmt, SWITCH_COND (switch_stmt));
SWITCH_TYPE (switch_stmt) = orig_type;