diff mbox

Go patch committed: Check for error type in binary expression

Message ID mcry66g98yb.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 19, 2011, 4:03 p.m. UTC
This patch to the Go frontend adds a check for an erroneous type when
determining the type of a binary expression.  This avoids a later crash
in a tuple assignment.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r c36661d8038e go/expressions.cc
--- a/go/expressions.cc	Wed Jan 19 07:46:28 2011 -0800
+++ b/go/expressions.cc	Wed Jan 19 08:00:05 2011 -0800
@@ -5396,7 +5396,11 @@ 
       {
 	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;