Commit 3fa057a4 by Ian Lance Taylor

compiler: Reject invalid nil == nil comparisons.

From-SVN: r194119
parent 98fd70c2
...@@ -5610,6 +5610,11 @@ Binary_expression::do_check_types(Gogo*) ...@@ -5610,6 +5610,11 @@ Binary_expression::do_check_types(Gogo*)
|| this->op_ == OPERATOR_GT || this->op_ == OPERATOR_GT
|| this->op_ == OPERATOR_GE) || this->op_ == OPERATOR_GE)
{ {
if (left_type->is_nil_type() && right_type->is_nil_type())
{
this->report_error(_("invalid comparison of nil with nil"));
return;
}
if (!Type::are_assignable(left_type, right_type, NULL) if (!Type::are_assignable(left_type, right_type, NULL)
&& !Type::are_assignable(right_type, left_type, NULL)) && !Type::are_assignable(right_type, left_type, NULL))
{ {
......
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