This patch by Chris Manghane fixes the Go frontend to not permit assigning to embedded builtin types in a composite literal for an imported struct. The builtin types are not exported names, but they are represented as simple names rather than as hidden names (with a leading dot). This is http://golang.org/issue/6832 . Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r e027abc3dc5b go/expressions.cc --- a/go/expressions.cc Tue Jan 06 16:14:01 2015 -0800 +++ b/go/expressions.cc Wed Jan 07 07:34:24 2015 -0800 @@ -12937,7 +12937,8 @@ pf != st->fields()->end(); ++pf) { - if (Gogo::is_hidden_name(pf->field_name())) + if (Gogo::is_hidden_name(pf->field_name()) + || pf->is_embedded_builtin(gogo)) error_at(this->location(), "assignment of unexported field %qs in %qs literal", Gogo::message_name(pf->field_name()).c_str(), @@ -13114,7 +13115,8 @@ if (type->named_type() != NULL && type->named_type()->named_object()->package() != NULL - && Gogo::is_hidden_name(sf->field_name())) + && (Gogo::is_hidden_name(sf->field_name()) + || sf->is_embedded_builtin(gogo))) error_at(name_expr->location(), "assignment of unexported field %qs in %qs literal", Gogo::message_name(sf->field_name()).c_str(),