From: Ian Lance Taylor Date: Wed, 7 Jan 2015 15:38:24 +0000 (+0000) Subject: compiler: Don't assign to embedded builtins in imported struct composite X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ee756af88e15fd3aaaf9a7ec37fdc9b1e873e557;p=gcc.git compiler: Don't assign to embedded builtins in imported struct composite literals. Fixes https://github.com/golang/go/issues/6832. From-SVN: r219313 --- diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index d386b81ce17..323ce16f93e 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -12937,7 +12937,8 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type) 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 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type) 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(),