From 5cb339bd6d8f85d260f961788603fc8ecb573b11 Mon Sep 17 00:00:00 2001 From: ian Date: Mon, 24 Nov 2014 17:10:20 +0000 Subject: [PATCH] compiler: Do not dereference a named pointer type when looking up a method. Fixes Issue 9018. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218026 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/types.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index ba0746139196..c85c72cb91b5 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -10035,6 +10035,18 @@ Type::find_field_or_method(const Type* type, if (found_level == 0) return false; + else if (found_is_method + && type->named_type() != NULL + && type->points_to() != NULL) + { + // If this is a method inherited from a struct field in a named pointer + // type, it is invalid to automatically dereference the pointer to the + // struct to find this method. + if (level != NULL) + *level = found_level; + *is_method = true; + return false; + } else if (!found_ambig1.empty()) { go_assert(!found_ambig1.empty()); -- 2.47.3