Commit 48347769 by Ian Lance Taylor

Don't crash on erroneous type switch.

From-SVN: r170386
parent 7b67393d
...@@ -3799,14 +3799,17 @@ Parse::switch_stat(const Label* label) ...@@ -3799,14 +3799,17 @@ Parse::switch_stat(const Label* label)
// This must be a TypeSwitchGuard. // This must be a TypeSwitchGuard.
switch_val = this->simple_stat(false, true, NULL, switch_val = this->simple_stat(false, true, NULL,
&type_switch); &type_switch);
if (!type_switch.found if (!type_switch.found)
&& !switch_val->is_error_expression()) {
if (switch_val == NULL
|| !switch_val->is_error_expression())
{ {
error_at(id_loc, "expected type switch assignment"); error_at(id_loc, "expected type switch assignment");
switch_val = Expression::make_error(id_loc); switch_val = Expression::make_error(id_loc);
} }
} }
} }
}
if (switch_val == NULL && !type_switch.found) if (switch_val == NULL && !type_switch.found)
{ {
switch_val = this->expression(PRECEDENCE_NORMAL, false, false, switch_val = this->expression(PRECEDENCE_NORMAL, false, false,
......
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