Go patch committed: Fix import of indirectly imported type alias

Ian Lance Taylor iant@golang.org
Thu Oct 12 19:11:00 GMT 2017


When the Go frontend imported a reference to an indirectly imported
type aliases, it was looking for the " = " before the optional package
name that appears for an indirect reference, but the exporter was
putting it after.  This patch fixes that.  The test case is
https://golang.org/cl/70290, and will be brought into the GCC
testsuite in due course.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
-------------- next part --------------
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 253664)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-af46ad16dc34773877068393d331ac8ae34b2219
+44132970e4b6c1186036bf8eda8982fb6e905d6f
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/import.cc
===================================================================
--- gcc/go/gofrontend/import.cc	(revision 253311)
+++ gcc/go/gofrontend/import.cc	(working copy)
@@ -756,13 +756,6 @@ Import::read_type()
 
   this->require_c_string(" ");
 
-  bool is_alias = false;
-  if (this->match_c_string("= "))
-    {
-      stream->advance(2);
-      is_alias = true;
-    }
-
   // The package name may follow.  This is the name of the package in
   // the package clause of that package.  The type name will include
   // the pkgpath, which may be different.
@@ -775,6 +768,13 @@ Import::read_type()
       this->require_c_string(" ");
     }
 
+  bool is_alias = false;
+  if (this->match_c_string("= "))
+    {
+      stream->advance(2);
+      is_alias = true;
+    }
+
   // Declare the type in the appropriate package.  If we haven't seen
   // it before, mark it as invisible.  We declare it before we read
   // the actual definition of the type, since the definition may refer


More information about the Gcc-patches mailing list