diff options
author | Mikhail Ablakatov <ablakatov.m@gmail.com> | 2022-05-12 21:45:35 +0300 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-06-16 12:26:15 -0700 |
commit | b2aaa44d2c9c0e5a31688a6e40a7b132dd03338a (patch) | |
tree | 2a6377a144c41214ce0cd7af530d380e2ba3fd25 /gcc/go | |
parent | 98a0d72a610a87e8e383d366e50253ddcc9a51dd (diff) | |
download | gcc-b2aaa44d2c9c0e5a31688a6e40a7b132dd03338a.zip gcc-b2aaa44d2c9c0e5a31688a6e40a7b132dd03338a.tar.gz gcc-b2aaa44d2c9c0e5a31688a6e40a7b132dd03338a.tar.bz2 |
compiler: don't generate stubs for ambiguous direct interface methods
Current implementation checks whether it has to generate a stub method for a
promoted method of an embedded struct field in Type::build_stub_methods(). If
the promoted method is ambiguous it's simply skipped. But struct types that
can fit in an interface value (e.g. structs that consist of a single pointer
field) get a second chance in Type::build_direct_iface_stub_methods().
This patch adds the same check used by Type::build_stub_methods() to
Type::build_direct_iface_stub_methods().
Fixes golang/go#52870
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405974
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.cc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index aeada9f..0cda305 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -bbb3a4347714faee620dc205674510a0f20b81ae +8db6b78110f84e22c409f334aeaefb80a8b39917 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index a8e3090..eb3afd9 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -11891,7 +11891,7 @@ Type::build_direct_iface_stub_methods(Gogo* gogo, const Type* type, need_stub = true; if (!in_heap && !m->is_value_method()) need_stub = true; - if (!need_stub) + if (!need_stub || m->is_ambiguous()) continue; Type* receiver_type = const_cast<Type*>(type); |