Commit 609df8a3 by Ian Lance Taylor

compiler: Don't allow shifts with non-integers.

    
    Fixes golang/go#11616.
    
    Reviewed-on: https://go-review.googlesource.com/13688

From-SVN: r227604
parent c41963bb
672ac2abc52d8bd70cb9fb03dd4a32fdde9c438f 913b47c957ea91db2f724491d88cb20e8f9be8c7
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.
...@@ -4523,6 +4523,12 @@ Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc, ...@@ -4523,6 +4523,12 @@ Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc,
return false; return false;
if (!is_shift && !right_nc->set_type(type, true, location)) if (!is_shift && !right_nc->set_type(type, true, location))
return false; return false;
if (is_shift
&& ((left_type->integer_type() == NULL
&& !left_type->is_abstract())
|| (right_type->integer_type() == NULL
&& !right_type->is_abstract())))
return false;
bool r; bool r;
if (type->complex_type() != NULL) if (type->complex_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