From: Ian Lance Taylor Date: Fri, 1 Feb 2019 15:00:46 +0000 (+0000) Subject: compiler: support alias to pointer type as receiver in method declaration X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=284c00e2109c4170bd8fd6f5a6d5e2b3ba7a8d4f;p=gcc.git compiler: support alias to pointer type as receiver in method declaration Fixes golang/go#27994. Reviewed-on: https://go-review.googlesource.com/c/160459 From-SVN: r268450 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index c9d68e1d6a4..b3f7c1be481 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -2206f40fc1e0e1e2ba3eacb7388dd26b72729bde +cbcc538adc5177778da5788d1101e16f106a1514 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/gogo.cc b/gcc/go/gofrontend/gogo.cc index b03051c2e80..6e1f1afb80d 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -2096,12 +2096,20 @@ Gogo::declare_function(const std::string& name, Function_type* type, // declarations. Type* rtype = type->receiver()->type(); + while (rtype->named_type() != NULL + && rtype->named_type()->is_alias()) + rtype = rtype->named_type()->real_type()->forwarded(); + // We want to look through the pointer created by the // parser, without getting an error if the type is not yet // defined. if (rtype->classification() == Type::TYPE_POINTER) rtype = rtype->points_to(); + while (rtype->named_type() != NULL + && rtype->named_type()->is_alias()) + rtype = rtype->named_type()->real_type()->forwarded(); + if (rtype->is_error_type()) return NULL; else if (rtype->named_type() != NULL)