aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2010-12-21 18:31:48 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2010-12-21 18:31:48 +0000
commit3868d6bfa679afaf881699faa86ea73dc5bd441f (patch)
tree449f6c9fe6c4e327e723244d725554cd23a633d1 /gcc
parentc8f2cf85f7acb152e68005efe628e831e528a6c6 (diff)
downloadgcc-3868d6bfa679afaf881699faa86ea73dc5bd441f.zip
gcc-3868d6bfa679afaf881699faa86ea73dc5bd441f.tar.gz
gcc-3868d6bfa679afaf881699faa86ea73dc5bd441f.tar.bz2
Report errors for temporary statements rather than crashing.
From-SVN: r168128
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/statements.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 97b8955..047045c 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -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.