Commit 8ca93ccf by Ian Lance Taylor

Don't crash if a constant has a declared but undefined type.

From-SVN: r170632
parent b58219c1
...@@ -926,7 +926,16 @@ Named_object::get_tree(Gogo* gogo, Named_object* function) ...@@ -926,7 +926,16 @@ Named_object::get_tree(Gogo* gogo, Named_object* function)
{ {
Type* type = named_constant->type(); Type* type = named_constant->type();
if (type != NULL && !type->is_abstract()) if (type != NULL && !type->is_abstract())
expr_tree = fold_convert(type->get_tree(gogo), expr_tree); {
if (!type->is_undefined())
expr_tree = fold_convert(type->get_tree(gogo), expr_tree);
else
{
// Make sure we report the error.
type->base();
expr_tree = error_mark_node;
}
}
if (expr_tree == error_mark_node) if (expr_tree == error_mark_node)
decl = error_mark_node; decl = error_mark_node;
else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree))) else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree)))
......
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