aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-03-20 19:37:50 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-03-20 19:37:50 +0000
commit207c82c407b6fe07c5768bf0542470f97bbd1a49 (patch)
treeae01dff00f20f7e3d35a510eb07e31d5675080f2
parente70c4c4189ff565b7b671ab2244eaa980b023866 (diff)
downloadgcc-207c82c407b6fe07c5768bf0542470f97bbd1a49.zip
gcc-207c82c407b6fe07c5768bf0542470f97bbd1a49.tar.gz
gcc-207c82c407b6fe07c5768bf0542470f97bbd1a49.tar.bz2
compiler: Consider the depth of a nested composite literal during traversal.
Fixes issue 7590. From-SVN: r208731
-rw-r--r--gcc/go/gofrontend/expressions.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 6ac18f5..643a233 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -13483,6 +13483,20 @@ Composite_literal_expression::do_traverse(Traverse* traverse)
{
// The type may not be resolvable at this point.
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)
{
if (type->classification() == Type::TYPE_NAMED)