summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-03-28 22:21:57 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-03-28 22:21:57 +0000
commit350733e3886c9b5474b7232e96442469523b6b8c (patch)
treee8b26cfea5231f33eea4a71bad7b79725bf32015
parent2defb110db56604247474b3dea21ebdd22a62ff0 (diff)
downloadgcc-350733e3886c9b5474b7232e96442469523b6b8c.tar.gz
compiler: fix method finalization of unnamed structs.
Used to trigger an ICE on var v struct{I}; type I interface{} Updates issue 7. From-SVN: r185931
-rw-r--r--gcc/go/gofrontend/gogo.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 5fe5aead9c0..ee68b69cc97 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -1653,8 +1653,12 @@ Finalize_methods::type(Type* t)
}
case Type::TYPE_STRUCT:
+ // Traverse the field types first in case there is an embedded
+ // field with methods that the struct should inherit.
+ if (t->struct_type()->traverse_field_types(this) == TRAVERSE_EXIT)
+ return TRAVERSE_EXIT;
t->struct_type()->finalize_methods(this->gogo_);
- break;
+ return TRAVERSE_SKIP_COMPONENTS;
default:
break;