diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-02 18:11:00 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-03 08:27:41 -0800 |
commit | 17c9cf3c17651950bd4bfefcbe15440fa2155810 (patch) | |
tree | 03367d24299f66cc435a6b1eecd846f33543095e /gcc/go/gofrontend/expressions.h | |
parent | cd34d5f2c40f3c65407f4b0bee0b49fc84e4a4ab (diff) | |
download | gcc-17c9cf3c17651950bd4bfefcbe15440fa2155810.zip gcc-17c9cf3c17651950bd4bfefcbe15440fa2155810.tar.gz gcc-17c9cf3c17651950bd4bfefcbe15440fa2155810.tar.bz2 |
compiler: cast comparison function result to expected bool type
Otherwise cases like
type mybool bool
var b mybool = [10]string{} == [10]string{}
get an incorrect type checking error.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/274446
Diffstat (limited to 'gcc/go/gofrontend/expressions.h')
-rw-r--r-- | gcc/go/gofrontend/expressions.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index d297523..259eeb6 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -2326,8 +2326,8 @@ class Call_expression : public Expression fn_(fn), args_(args), type_(NULL), call_(NULL), call_temp_(NULL) , expected_result_count_(0), is_varargs_(is_varargs), varargs_are_lowered_(false), types_are_determined_(false), - is_deferred_(false), is_concurrent_(false), issued_error_(false), - is_multi_value_arg_(false), is_flattened_(false) + is_deferred_(false), is_concurrent_(false), is_equal_function_(false), + issued_error_(false), is_multi_value_arg_(false), is_flattened_(false) { } // The function to call. @@ -2408,6 +2408,11 @@ class Call_expression : public Expression set_is_concurrent() { this->is_concurrent_ = true; } + // Note that this is a call to a generated equality function. + void + set_is_equal_function() + { this->is_equal_function_ = true; } + // We have found an error with this call expression; return true if // we should report it. bool @@ -2545,6 +2550,8 @@ class Call_expression : public Expression bool is_deferred_; // True if the call is an argument to a go statement. bool is_concurrent_; + // True if this is a call to a generated equality function. + bool is_equal_function_; // True if we reported an error about a mismatch between call // results and uses. This is to avoid producing multiple errors // when there are multiple Call_result_expressions. |