Commit 62d1a8f9 by Ian Lance Taylor

Avoid crash when an unknown object is declared as a type.

From-SVN: r168188
parent 7838059f
...@@ -1248,14 +1248,20 @@ Unknown_expression::do_lower(Gogo*, Named_object*, int) ...@@ -1248,14 +1248,20 @@ Unknown_expression::do_lower(Gogo*, Named_object*, int)
{ {
source_location location = this->location(); source_location location = this->location();
Named_object* no = this->named_object_; Named_object* no = this->named_object_;
Named_object* real = no->unknown_value()->real_named_object(); Named_object* real;
if (real == NULL) if (!no->is_unknown())
real = no;
else
{ {
if (this->is_composite_literal_key_) real = no->unknown_value()->real_named_object();
return this; if (real == NULL)
error_at(location, "reference to undefined name %qs", {
this->named_object_->message_name().c_str()); if (this->is_composite_literal_key_)
return Expression::make_error(location); return this;
error_at(location, "reference to undefined name %qs",
this->named_object_->message_name().c_str());
return Expression::make_error(location);
}
} }
switch (real->classification()) switch (real->classification())
{ {
......
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