Skip to content

Commit abd26de

Browse files
author
ian
committed
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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226596 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent d352eaa commit abd26de

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

gcc/go/gofrontend/MERGE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
bdd98c601f2c8dbd0bf821548ba09c038f7645c4
1+
df080adb06f0e423820f3f6b9604b0c1093ff20a
22

33
The first line of this file holds the git revision number of the last
44
merge done from the gofrontend repository.

gcc/go/gofrontend/expressions.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -2396,7 +2396,7 @@ class Complex_expression : public Expression
23962396

23972397
void
23982398
do_dump_expression(Ast_dump_context*) const;
2399-
2399+
24002400
private:
24012401
// The complex value.
24022402
mpc_t val_;
@@ -2423,8 +2423,7 @@ Complex_expression::do_determine_type(const Type_context* context)
24232423
{
24242424
if (this->type_ != NULL && !this->type_->is_abstract())
24252425
;
2426-
else if (context->type != NULL
2427-
&& context->type->complex_type() != NULL)
2426+
else if (context->type != NULL && context->type->is_numeric_type())
24282427
this->type_ = context->type;
24292428
else if (!context->may_be_abstract)
24302429
this->type_ = Type::lookup_complex_type("complex128");

0 commit comments

Comments
 (0)