Commit 113950b7 by Ian Lance Taylor

compiler: fix 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.
    
    Test case is in https://golang.org/cl/123477.
    
    Fixes golang/go#26340
    
    Reviewed-on: https://go-review.googlesource.com/123479

From-SVN: r262641
parent 6b34716b
267686fd1dffbc03e610e9f17dadb4e72c75f18d 3f7e72eca3f9221e67c055841d42851aa6a66aff
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -13666,6 +13666,7 @@ Composite_literal_expression::do_lower(Gogo* gogo, Named_object* function, ...@@ -13666,6 +13666,7 @@ Composite_literal_expression::do_lower(Gogo* gogo, Named_object* function,
for (int depth = 0; depth < this->depth_; ++depth) for (int depth = 0; depth < this->depth_; ++depth)
{ {
type = type->deref();
if (type->array_type() != NULL) if (type->array_type() != NULL)
type = type->array_type()->element_type(); type = type->array_type()->element_type();
else if (type->map_type() != NULL) else if (type->map_type() != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment