Check for error type when getting type of binary expression.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 19 Jan 2011 16:03:55 +0000 (16:03 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 19 Jan 2011 16:03:55 +0000 (16:03 +0000)
From-SVN: r169002

gcc/go/gofrontend/expressions.cc

index 819fb616452b786f59a3658526e2011b22cace03..5afe163b760671d5b5290d6d93989c11006fb078 100644 (file)
@@ -5396,7 +5396,11 @@ Binary_expression::do_type()
       {
        Type* left_type = this->left_->type();
        Type* right_type = this->right_->type();
-       if (!left_type->is_abstract() && left_type->named_type() != NULL)
+       if (left_type->is_error_type())
+         return left_type;
+       else if (right_type->is_error_type())
+         return right_type;
+       else if (!left_type->is_abstract() && left_type->named_type() != NULL)
          return left_type;
        else if (!right_type->is_abstract() && right_type->named_type() != NULL)
          return right_type;