Further testing revealed that I goofed on the hidden field patch I just committed, and was too aggressive on testing for assignments to hidden fields in composite literals. It is OK to assign to a type which itself contains hidden fields in a composite literal; that is just an example of assignment, which is now permitted. This patch fixes that. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r c5598ae02285 go/expressions.cc --- a/go/expressions.cc Thu Dec 08 15:25:25 2011 -0800 +++ b/go/expressions.cc Thu Dec 08 16:06:29 2011 -0800 @@ -12986,18 +12986,6 @@ "assignment of unexported field %qs in %qs literal", Gogo::message_name(sf->field_name()).c_str(), type->named_type()->message_name().c_str()); - else - { - std::string reason; - if (sf->type()->has_hidden_fields(NULL, &reason)) - { - if (reason.empty()) - error_at(name_expr->location(), - "implicit assignment of hidden field"); - else - error_at(name_expr->location(), "%s", reason.c_str()); - } - } vals[index] = val; }