mirror of git://gcc.gnu.org/git/gcc.git
compiler: structs inherit all methods from embedded pointer fields.
Previously if a struct S contained an embedded field *T, a method with receiver *T would not be promoted to a method with value receiver S. From-SVN: r200493
This commit is contained in:
parent
ea16999619
commit
4a197d64cb
|
|
@ -9396,13 +9396,18 @@ Type::find_field_or_method(const Type* type,
|
|||
fnt = pf->type()->deref()->named_type();
|
||||
go_assert(fnt != NULL);
|
||||
|
||||
// Methods with pointer receivers on embedded field are
|
||||
// inherited by the pointer to struct, and also by the struct
|
||||
// type if the field itself is a pointer.
|
||||
bool can_be_pointer = (receiver_can_be_pointer
|
||||
|| pf->type()->points_to() != NULL);
|
||||
int sublevel = level == NULL ? 1 : *level + 1;
|
||||
bool sub_is_method;
|
||||
std::string subambig1;
|
||||
std::string subambig2;
|
||||
bool subfound = Type::find_field_or_method(fnt,
|
||||
name,
|
||||
receiver_can_be_pointer,
|
||||
can_be_pointer,
|
||||
seen,
|
||||
&sublevel,
|
||||
&sub_is_method,
|
||||
|
|
|
|||
Loading…
Reference in New Issue