From: Ian Lance Taylor Date: Tue, 21 Dec 2010 18:31:48 +0000 (+0000) Subject: Report errors for temporary statements rather than crashing. X-Git-Tag: releases/gcc-4.6.0~1703 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3868d6bfa679afaf881699faa86ea73dc5bd441f;p=thirdparty%2Fgcc.git Report errors for temporary statements rather than crashing. From-SVN: r168128 --- diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index 97b89551e279..047045cffc37 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.