From 17c9cf3c17651950bd4bfefcbe15440fa2155810 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 2 Dec 2020 18:11:00 -0800 Subject: 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 --- gcc/go/gofrontend/expressions.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gcc/go/gofrontend/expressions.h') 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. -- cgit v1.1