Commit 8211d03c by Ian Lance Taylor

Don't crash asking for type of invalid const.

From-SVN: r168194
parent bf0a2edc
...@@ -894,6 +894,19 @@ Expression::make_type(Type* type, source_location location) ...@@ -894,6 +894,19 @@ Expression::make_type(Type* type, source_location location)
return new Type_expression(type, location); return new Type_expression(type, location);
} }
// Class Parser_expression.
Type*
Parser_expression::do_type()
{
// We should never really ask for the type of a Parser_expression.
// However, it can happen, at least when we have an invalid const
// whose initializer refers to the const itself. In that case we
// may ask for the type when lowering the const itself.
gcc_assert(saw_errors());
return Type::make_error_type();
}
// Class Var_expression. // Class Var_expression.
// Lower a variable expression. Here we just make sure that the // Lower a variable expression. Here we just make sure that the
......
...@@ -873,8 +873,7 @@ class Parser_expression : public Expression ...@@ -873,8 +873,7 @@ class Parser_expression : public Expression
do_lower(Gogo*, Named_object*, int) = 0; do_lower(Gogo*, Named_object*, int) = 0;
Type* Type*
do_type() do_type();
{ gcc_unreachable(); }
void void
do_determine_type(const Type_context*) do_determine_type(const Type_context*)
......
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