Commit 2fbb4d75 by Ian Lance Taylor

Better error when setting const to nil.

From-SVN: r171541
parent e2e5c70f
...@@ -1527,7 +1527,9 @@ Check_types_traverse::constant(Named_object* named_object, bool) ...@@ -1527,7 +1527,9 @@ Check_types_traverse::constant(Named_object* named_object, bool)
&& !ctype->is_boolean_type() && !ctype->is_boolean_type()
&& !ctype->is_string_type()) && !ctype->is_string_type())
{ {
if (!ctype->is_error()) if (ctype->is_nil_type())
error_at(constant->location(), "const initializer cannot be nil");
else if (!ctype->is_error())
error_at(constant->location(), "invalid constant type"); error_at(constant->location(), "invalid constant type");
constant->set_error(); constant->set_error();
} }
......
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