OSDN Git Service

compiler: Fix names for hash/equality functions for unnamed types.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Jan 2012 16:28:08 +0000 (16:28 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Jan 2012 16:28:08 +0000 (16:28 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183098 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/types.cc

index d93b68b..21dac51 100644 (file)
@@ -1504,7 +1504,17 @@ Type::specific_type_functions(Gogo* gogo, Named_type* name,
 
   std::string base_name;
   if (name == NULL)
-    base_name = gogo->pack_hidden_name(this->mangled_name(gogo), false);
+    {
+      // Mangled names can have '.' if they happen to refer to named
+      // types in some way.  That's fine if this is simply a named
+      // type, but otherwise it will confuse the code that builds
+      // function identifiers.  Remove '.' when necessary.
+      base_name = this->mangled_name(gogo);
+      size_t i;
+      while ((i = base_name.find('.')) != std::string::npos)
+       base_name[i] = '$';
+      base_name = gogo->pack_hidden_name(base_name, false);
+    }
   else
     {
       // This name is already hidden or not as appropriate.