This patch by Chris Manghane fixes a bug in which gccgo could incorrectly report an invalid initializer loop when a struct field name is confused with a variable name. This is http://golang.org/issue/7590. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r d43179a88410 go/expressions.cc --- a/go/expressions.cc Mon Mar 17 21:25:04 2014 -0700 +++ b/go/expressions.cc Thu Mar 20 11:49:49 2014 -0700 @@ -12993,6 +12993,20 @@ { // 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)