aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/go/gofrontend/types.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index aa331c2..86efc3b 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -8052,9 +8052,9 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
const std::string& name,
std::vector<const Named_type*>* seen)
{
- type = type->deref();
-
const Named_type* nt = type->named_type();
+ if (nt == NULL)
+ nt = type->deref()->named_type();
if (nt != NULL)
{
if (nt->is_unexported_local_method(gogo, name))
@@ -8072,6 +8072,8 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
}
}
+ type = type->deref();
+
const Interface_type* it = type->interface_type();
if (it != NULL && it->is_unexported_method(gogo, name))
return true;
@@ -8095,11 +8097,17 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
++pf)
{
if (pf->is_anonymous()
- && (!pf->type()->deref()->is_error_type()
- && !pf->type()->deref()->is_undefined()))
+ && !pf->type()->deref()->is_error_type()
+ && !pf->type()->deref()->is_undefined())
{
- Named_type* subtype = pf->type()->deref()->named_type();
- gcc_assert(subtype != NULL);
+ Named_type* subtype = pf->type()->named_type();
+ if (subtype == NULL)
+ subtype = pf->type()->deref()->named_type();
+ if (subtype == NULL)
+ {
+ // This is an error, but it will be diagnosed elsewhere.
+ continue;
+ }
if (Type::is_unexported_field_or_method(gogo, subtype, name, seen))
{
if (nt != NULL)