aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/gogo-tree.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-10-11 22:53:17 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-10-11 22:53:17 +0000
commit55e0ab1ad90b446e5fda024a35474a0b5a0ab386 (patch)
tree34dffec5bc928bd0f98e09d5dc441034f6eb6c68 /gcc/go/gofrontend/gogo-tree.cc
parentb7d93b468a08d46d5bd7d0ed9e08695eef89ce24 (diff)
downloadgcc-55e0ab1ad90b446e5fda024a35474a0b5a0ab386.zip
gcc-55e0ab1ad90b446e5fda024a35474a0b5a0ab386.tar.gz
gcc-55e0ab1ad90b446e5fda024a35474a0b5a0ab386.tar.bz2
compiler: Fix handling of hidden methods for unnamed types.
If an interface has hidden methods, we must make the interface table comdat if it is for an unnamed type. When we create a stub method for an unnamed type, don't make it publically visible. From-SVN: r203468
Diffstat (limited to 'gcc/go/gofrontend/gogo-tree.cc')
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc
index fbc4652..ca80869 100644
--- a/gcc/go/gofrontend/gogo-tree.cc
+++ b/gcc/go/gofrontend/gogo-tree.cc
@@ -2154,10 +2154,11 @@ Gogo::interface_method_table_for_type(const Interface_type* interface,
TREE_CONSTANT(decl) = 1;
DECL_INITIAL(decl) = constructor;
- // If the interface type has hidden methods, then this is the only
- // definition of the table. Otherwise it is a comdat table which
- // may be defined in multiple packages.
- if (has_hidden_methods)
+ // If the interface type has hidden methods, and the table is for a
+ // named type, then this is the only definition of the table.
+ // Otherwise it is a comdat table which may be defined in multiple
+ // packages.
+ if (has_hidden_methods && type->named_type() != NULL)
TREE_PUBLIC(decl) = 1;
else
{