Commit 62d1a8f9 by Ian Lance Taylor

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

From-SVN: r168188
parent 7838059f
...@@ -1248,7 +1248,12 @@ Unknown_expression::do_lower(Gogo*, Named_object*, int) ...@@ -1248,7 +1248,12 @@ 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 (!no->is_unknown())
real = no;
else
{
real = no->unknown_value()->real_named_object();
if (real == NULL) if (real == NULL)
{ {
if (this->is_composite_literal_key_) if (this->is_composite_literal_key_)
...@@ -1257,6 +1262,7 @@ Unknown_expression::do_lower(Gogo*, Named_object*, int) ...@@ -1257,6 +1262,7 @@ Unknown_expression::do_lower(Gogo*, Named_object*, int)
this->named_object_->message_name().c_str()); this->named_object_->message_name().c_str());
return Expression::make_error(location); return Expression::make_error(location);
} }
}
switch (real->classification()) switch (real->classification())
{ {
case Named_object::NAMED_OBJECT_CONST: case Named_object::NAMED_OBJECT_CONST:
......
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