diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-21 18:31:48 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-12-21 18:31:48 +0000 |
commit | 56b16b8b2d32371c6bb1f31eae4234adb399584f (patch) | |
tree | 449f6c9fe6c4e327e723244d725554cd23a633d1 | |
parent | 8202da1a0bb236d33fcaa6f8d636e8960157cefe (diff) | |
download | gcc-56b16b8b2d32371c6bb1f31eae4234adb399584f.tar.gz |
Report errors for temporary statements rather than crashing.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168128 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/go/gofrontend/statements.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index 97b89551e27..047045cffc3 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. |