Commit 207c82c4 by Ian Lance Taylor

compiler: Consider the depth of a nested composite literal during traversal.

Fixes issue 7590.

From-SVN: r208731
parent e70c4c41
...@@ -13483,6 +13483,20 @@ Composite_literal_expression::do_traverse(Traverse* traverse) ...@@ -13483,6 +13483,20 @@ Composite_literal_expression::do_traverse(Traverse* traverse)
{ {
// The type may not be resolvable at this point. // The type may not be resolvable at this point.
Type* type = this->type_; Type* type = this->type_;
for (int depth = this->depth_; depth > 0; --depth)
{
if (type->array_type() != NULL)
type = type->array_type()->element_type();
else if (type->map_type() != NULL)
type = type->map_type()->val_type();
else
{
// This error will be reported during lowering.
return TRAVERSE_CONTINUE;
}
}
while (true) while (true)
{ {
if (type->classification() == Type::TYPE_NAMED) if (type->classification() == Type::TYPE_NAMED)
......
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