This patch to the Go frontend omits the field name for embedded fields in the reflect string. This matches the gc compiler. The test case was sent for the master repo as https://golang.org/cl/91138. This fixes https://golang.org/issue/23620. 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 257299) +++ gcc/go/gofrontend/MERGE (working copy) @@ -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. Index: gcc/go/gofrontend/types.cc =================================================================== --- gcc/go/gofrontend/types.cc (revision 257217) +++ gcc/go/gofrontend/types.cc (working copy) @@ -6417,11 +6417,11 @@ Struct_type::do_reflection(Gogo* gogo, s 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()) Index: libgo/go/reflect/all_test.go =================================================================== --- libgo/go/reflect/all_test.go (revision 257217) +++ libgo/go/reflect/all_test.go (working copy) @@ -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{