compiler: fix parsing of composite literals with omitted pointer types
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 13 Jul 2018 18:25:27 +0000 (18:25 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 13 Jul 2018 18:25:27 +0000 (18:25 +0000)
    The frontend could parse omitted pointer typess at the end of the
    type, but not in the middle, so code like []*[][]int{{{1}}} failed.

    Test case is in https://golang.org/cl/123477.

    Fixes golang/go#26340

    Reviewed-on: https://go-review.googlesource.com/123479

From-SVN: r262641

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc

index a18e3f3..8aaa045 100644 (file)
@@ -1,4 +1,4 @@
-267686fd1dffbc03e610e9f17dadb4e72c75f18d
+3f7e72eca3f9221e67c055841d42851aa6a66aff
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index e7d0b75..2c2ae1c 100644 (file)
@@ -13666,6 +13666,7 @@ Composite_literal_expression::do_lower(Gogo* gogo, Named_object* function,
 
   for (int depth = 0; depth < this->depth_; ++depth)
     {
+      type = type->deref();
       if (type->array_type() != NULL)
        type = type->array_type()->element_type();
       else if (type->map_type() != NULL)