mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 01:50:34 +08:00
Report errors for temporary statements rather than crashing.
From-SVN: r168128
This commit is contained in:
parent
c8f2cf85f7
commit
3868d6bfa6
@ -350,7 +350,18 @@ void
|
||||
Temporary_statement::do_check_types(Gogo*)
|
||||
{
|
||||
if (this->type_ != NULL && this->init_ != NULL)
|
||||
gcc_assert(Type::are_assignable(this->type_, this->init_->type(), NULL));
|
||||
{
|
||||
std::string reason;
|
||||
if (!Type::are_assignable(this->type_, this->init_->type(), &reason))
|
||||
{
|
||||
if (reason.empty())
|
||||
error_at(this->location(), "incompatible types in assignment");
|
||||
else
|
||||
error_at(this->location(), "incompatible types in assignment (%s)",
|
||||
reason.c_str());
|
||||
this->set_is_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return a tree.
|
||||
|
Loading…
x
Reference in New Issue
Block a user