Don't crash on invalid type conversion.
From-SVN: r168161
This commit is contained in:
parent
8dcfef8f2b
commit
ecdacbb305
1 changed files with 12 additions and 0 deletions
|
@ -3242,6 +3242,18 @@ Type_conversion_expression::do_check_types(Gogo*)
|
|||
Type* expr_type = this->expr_->type();
|
||||
std::string reason;
|
||||
|
||||
if (type->is_error_type()
|
||||
|| type->is_undefined()
|
||||
|| expr_type->is_error_type()
|
||||
|| expr_type->is_undefined())
|
||||
{
|
||||
// Make sure we emit an error for an undefined type.
|
||||
type->base();
|
||||
expr_type->base();
|
||||
this->set_is_error();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->may_convert_function_types_
|
||||
&& type->function_type() != NULL
|
||||
&& expr_type->function_type() != NULL)
|
||||
|
|
Loading…
Add table
Reference in a new issue