Commit ca0401be by Ian Lance Taylor

compiler: It's OK to assign a struct with hidden fields in a literal.

From-SVN: r182144
parent 1fbbc69c
...@@ -12986,18 +12986,6 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type) ...@@ -12986,18 +12986,6 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
"assignment of unexported field %qs in %qs literal", "assignment of unexported field %qs in %qs literal",
Gogo::message_name(sf->field_name()).c_str(), Gogo::message_name(sf->field_name()).c_str(),
type->named_type()->message_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; vals[index] = val;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment