Commit 28c64f64 by Ian Lance Taylor

compiler: Report errors for non-integral shift counts.

    
    Fixes golang/go#12618.
    
    Reviewed-on: https://go-review.googlesource.com/14647

From-SVN: r229096
parent 51090a41
a4bcd319d98ddc52b3e7d16ec87d92aad868ab05 302d8abbc499e28088d758ae8b2c024d8e50b9b3
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -5601,7 +5601,9 @@ Binary_expression::do_check_types(Gogo*) ...@@ -5601,7 +5601,9 @@ Binary_expression::do_check_types(Gogo*)
if (left_type->integer_type() == NULL) if (left_type->integer_type() == NULL)
this->report_error(_("shift of non-integer operand")); this->report_error(_("shift of non-integer operand"));
if (!right_type->is_abstract() if (right_type->is_string_type())
this->report_error(_("shift count not unsigned integer"));
else if (!right_type->is_abstract()
&& (right_type->integer_type() == NULL && (right_type->integer_type() == NULL
|| !right_type->integer_type()->is_unsigned())) || !right_type->integer_type()->is_unsigned()))
this->report_error(_("shift count not unsigned integer")); this->report_error(_("shift count not unsigned integer"));
......
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