diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-04 22:27:48 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-04 22:27:48 +0000 |
commit | d69eea11a43b4ae992ecf0ce780f2f4143be72f8 (patch) | |
tree | 1dcdbbe2e9d40efb986d34d7c3a2dd5ee4aaacca /gcc/go | |
parent | f12021edbe3e4806ce83c6c1d12b50d7f4f9d528 (diff) | |
download | gcc-d69eea11a43b4ae992ecf0ce780f2f4143be72f8.zip gcc-d69eea11a43b4ae992ecf0ce780f2f4143be72f8.tar.gz gcc-d69eea11a43b4ae992ecf0ce780f2f4143be72f8.tar.bz2 |
compiler: Use context to determine types of complex expressions.
When determining the type of a complex expression, it is important
to recognize cases where a complex value can be represented as a
real number.
Fixes golang/go#11572.
Reviewed-on: https://go-review.googlesource.com/12541
From-SVN: r226596
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index ed65dfd..70d19fb 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -bdd98c601f2c8dbd0bf821548ba09c038f7645c4 +df080adb06f0e423820f3f6b9604b0c1093ff20a The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 976e34b..3aabbab 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -2396,7 +2396,7 @@ class Complex_expression : public Expression void do_dump_expression(Ast_dump_context*) const; - + private: // The complex value. mpc_t val_; @@ -2423,8 +2423,7 @@ Complex_expression::do_determine_type(const Type_context* context) { if (this->type_ != NULL && !this->type_->is_abstract()) ; - else if (context->type != NULL - && context->type->complex_type() != NULL) + else if (context->type != NULL && context->type->is_numeric_type()) this->type_ = context->type; else if (!context->may_be_abstract) this->type_ = Type::lookup_complex_type("complex128"); |