]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: omit field name for embedded fields in reflection string
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 1 Feb 2018 15:54:04 +0000 (15:54 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 1 Feb 2018 15:54:04 +0000 (15:54 +0000)
    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

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/types.cc
libgo/go/reflect/all_test.go

index 935c0880db86eb651e298c618fe5855bc74e1c33..6e580389d91e57fee87c5e8b691b7335d94b0f0c 100644 (file)
@@ -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 a0c81c079c062bb855756f0e36c65989d2ec2689..ea9d81d4e24dfd13d9e51a50b5a3efe4c8b60763 100644 (file)
@@ -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())
index 6e748599de5e00d615b438b98a41c4c29b307406..86e738555f86441424b3426abe391c9d14bc4074 100644 (file)
@@ -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{