Improve error about indirecting an unsafe.Pointer type.

From-SVN: r171574
This commit is contained in:
Ian Lance Taylor 2011-03-27 16:40:24 +00:00
parent fbe185d3de
commit 15ea09a082
1 changed files with 8 additions and 0 deletions

View File

@ -3669,6 +3669,14 @@ Unary_expression::do_lower(Gogo*, Named_object*, int)
}
}
// Catching an invalid indirection of unsafe.Pointer here avoid
// having to deal with TYPE_VOID in other places.
if (op == OPERATOR_MULT && expr->type()->is_unsafe_pointer_type())
{
error_at(this->location(), "invalid indirect of %<unsafe.Pointer%>");
return Expression::make_error(this->location());
}
if (op == OPERATOR_PLUS || op == OPERATOR_MINUS
|| op == OPERATOR_NOT || op == OPERATOR_XOR)
{