This patch by Chris Manghane fixes the Go frontend to use the type context to determine the type of a complex constant. This fixes https://golang.org/issue/11572 . Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 226543) +++ gcc/go/gofrontend/MERGE (working copy) @@ -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. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 226510) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -2396,7 +2396,7 @@ class Complex_expression : public Expres void do_dump_expression(Ast_dump_context*) const; - + private: // The complex value. mpc_t val_; @@ -2423,8 +2423,7 @@ Complex_expression::do_determine_type(co { 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");