diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-01 15:54:04 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-01 15:54:04 +0000 |
commit | 4d0bf3e1e184f78d4a2716245aa963aef0e918cf (patch) | |
tree | 2ce98ab8a911ab2b8b2fadad8a9e68096c4b9c8a | |
parent | fc876f22b348202addb9294a6fe8570cdbfa1753 (diff) | |
download | gcc-4d0bf3e1e184f78d4a2716245aa963aef0e918cf.zip gcc-4d0bf3e1e184f78d4a2716245aa963aef0e918cf.tar.gz gcc-4d0bf3e1e184f78d4a2716245aa963aef0e918cf.tar.bz2 |
compiler: omit field name for embedded fields in reflection string
This matches the gc compiler.
The test case was sent for the master repo as
https://golang.org/cl/91138.
Fixes golang/go#23620
Reviewed-on: https://go-review.googlesource.com/91139
From-SVN: r257300
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.cc | 10 | ||||
-rw-r--r-- | libgo/go/reflect/all_test.go | 8 |
3 files changed, 14 insertions, 6 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 935c088..6e58038 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -b833695618d1a5d9d531f5ba0f9c07c7e35e0073 +023c3d4358d101c71ac1436065690eaec2ce138e 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 a0c81c0..ea9d81d 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -6417,11 +6417,11 @@ Struct_type::do_reflection(Gogo* gogo, std::string* ret) const if (p != this->fields_->begin()) ret->push_back(';'); ret->push_back(' '); - if (p->is_anonymous()) - ret->push_back('?'); - else - ret->append(Gogo::unpack_hidden_name(p->field_name())); - ret->push_back(' '); + if (!p->is_anonymous()) + { + ret->append(Gogo::unpack_hidden_name(p->field_name())); + ret->push_back(' '); + } if (p->is_anonymous() && p->type()->named_type() != NULL && p->type()->named_type()->is_alias()) diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go index 6e74859..86e7385 100644 --- a/libgo/go/reflect/all_test.go +++ b/libgo/go/reflect/all_test.go @@ -170,6 +170,14 @@ var typeTests = []pair{ }{}, "interface { reflect_test.a(func(func(int) int) func(func(int)) int); reflect_test.b() }", }, + {struct { + x struct { + int32 + int64 + } + }{}, + "struct { int32; int64 }", + }, } var valueTests = []pair{ |