The Go compiler always builds the pointer type for any named type, so that it can attach methods in case the program calls reflect.PtrTo. However, it didn't do that for unnamed types that happened to have methods due to inheritance. This patch fixes that problem. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 229546) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -85994dd0a88d1b24b2ddfc9c9ab22ee16c9e8b54 +16f69a4007a1903da4055a496882b514e05f45f3 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/types.cc =================================================================== --- gcc/go/gofrontend/types.cc (revision 229546) +++ gcc/go/gofrontend/types.cc (working copy) @@ -2064,11 +2064,15 @@ Type::type_descriptor_constructor(Gogo* ++p; go_assert(p->is_field_name("ptrToThis")); - if (name == NULL) + if (name == NULL && methods == NULL) vals->push_back(Expression::make_nil(bloc)); else { - Type* pt = Type::make_pointer_type(name); + Type* pt; + if (name != NULL) + pt = Type::make_pointer_type(name); + else + pt = Type::make_pointer_type(this); vals->push_back(Expression::make_type_descriptor(pt, bloc)); }