Commit 48347769 by Ian Lance Taylor

Don't crash on erroneous type switch.

From-SVN: r170386
parent 7b67393d
...@@ -3799,11 +3799,14 @@ Parse::switch_stat(const Label* label) ...@@ -3799,11 +3799,14 @@ 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())
{ {
error_at(id_loc, "expected type switch assignment"); if (switch_val == NULL
switch_val = Expression::make_error(id_loc); || !switch_val->is_error_expression())
{
error_at(id_loc, "expected type switch assignment");
switch_val = Expression::make_error(id_loc);
}
} }
} }
} }
......
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