My understanding of shifts of constants in Go has improved.  This patch
more accurately reflects the language spec when it comes to reporting
errors for invalid shifts.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 9be532343312 go/expressions.cc
--- a/go/expressions.cc	Thu Dec 13 14:14:53 2012 -0800
+++ b/go/expressions.cc	Fri Dec 14 06:45:18 2012 -0800
@@ -5463,13 +5463,10 @@
       // Give a useful error if that happened.
       if (tleft->is_abstract()
 	  && subcontext.type != NULL
-	  && (this->left_->type()->integer_type() == NULL
-	      || (subcontext.type->integer_type() == NULL
-		  && subcontext.type->float_type() == NULL
-		  && subcontext.type->complex_type() == NULL
-		  && subcontext.type->interface_type() == NULL)))
+	  && !subcontext.may_be_abstract
+	  && subcontext.type->integer_type() == NULL)
 	this->report_error(("invalid context-determined non-integer type "
-			    "for shift operand"));
+			    "for left operand of shift"));
 
       // The context for the right hand operand is the same as for the
       // left hand operand, except for a shift operator.

Reply via email to