From a982fddb190e86a03cab4d6f054cc8d23b3428cc Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 28 Mar 2012 22:21:57 +0000 Subject: [PATCH] compiler: fix method finalization of unnamed structs. Used to trigger an ICE on var v struct{I}; type I interface{} Updates issue 7. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185931 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 5fe5aea..ee68b69 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; -- 2.7.4