Go patch commited: Fix parsing of composite literals with omitted pointer types

Message ID CAOyqgcXKnS5JAFBVzAxNBk5yF=OfcDpv9oH6-f+LqFOJ6i2z6Q@mail.gmail.com
State New
Headers show
Series
  • Go patch commited: Fix parsing of composite literals with omitted pointer types
Related show

Commit Message

Ian Lance Taylor July 13, 2018, 6:25 p.m.
This patch to the Go frontend fixes parsing of composite literals with
omitted pointer types.  The frontend could parse omitted pointer
typess at the end of the type, but not in the middle, so code like
[]*[][]int{{{1}}} failed.  A test case is in
https://golang.org/cl/123477.  This fixes
https://golang.org/issue/26340.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 262572)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc	(revision 262554)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -13666,6 +13666,7 @@  Composite_literal_expression::do_lower(G
 
   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)