compiler: generate type descriptor for pointer to alias defined in another package

When a type descriptor is needed (for e.g. interface conversion),
if the type is a pointer to a named type defined in another
package, we don't generate the definition of the type descriptor
because it is generated in the package where the type is defined.
However, if the named type is an alias to an unnamed type, its
descriptor is not generated in the other package, and we need to
generate it.

Change-Id: Id54edb1e0df0bf65f755433118da3da00f0186d3
Reviewed-by: Ian Lance Taylor <>
diff --git a/go/ b/go/
index e02b832..7afdba7 100644
--- a/go/
+++ b/go/
@@ -1453,13 +1453,13 @@
       if (this->points_to() != NULL
-	  && this->points_to()->named_type() != NULL
-	  && this->points_to()->named_type()->named_object()->package() != NULL)
+	  && this->points_to()->unalias()->named_type() != NULL
+	  && this->points_to()->unalias()->named_type()->named_object()->package() != NULL)
 	  // This is an unnamed pointer to a named type defined in a
 	  // different package.  The descriptor should be defined in
 	  // that package.
-	  *package = this->points_to()->named_type()->named_object()->package();
+	  *package = this->points_to()->unalias()->named_type()->named_object()->package();
 	  return true;