Don't crash using value of something with no value.

From-SVN: r168982
This commit is contained in:
Ian Lance Taylor 2011-01-19 05:38:41 +00:00
parent 8386b63d3d
commit d4d2a98fb2

View File

@ -482,6 +482,15 @@ bool
Type::are_assignable(const Type* lhs, const Type* rhs, std::string* reason)
{
// Do some checks first. Make sure the types are defined.
if (rhs != NULL
&& rhs->forwarded()->forward_declaration_type() == NULL
&& rhs->is_void_type())
{
if (reason != NULL)
*reason = "non-value used as value";
return false;
}
if (lhs != NULL && lhs->forwarded()->forward_declaration_type() == NULL)
{
// Any value may be assigned to the blank identifier.