Don't crash on invalid type conversion.

From-SVN: r168161
This commit is contained in:
Ian Lance Taylor 2010-12-22 06:17:55 +00:00
parent 8dcfef8f2b
commit ecdacbb305

View file

@ -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)