compiler: support alias to pointer type as receiver in method declaration
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 1 Feb 2019 15:00:46 +0000 (15:00 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 1 Feb 2019 15:00:46 +0000 (15:00 +0000)
    Fixes golang/go#27994.

    Reviewed-on: https://go-review.googlesource.com/c/160459

From-SVN: r268450

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc

index c9d68e1d6a4c950e90684fcb37409d2e980ba5d1..b3f7c1be4810ff8f7eeefd8874f5d14118b246b8 100644 (file)
@@ -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.
index b03051c2e803abe8a8a3845f36133a3726b981f7..6e1f1afb80de6e2f61c6a3adb34e353e9bed13f4 100644 (file)
@@ -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)