2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-04-15 13:30:59 +08:00

Don't crash if a temporary is not defined due to errors.

From-SVN: r168173
This commit is contained in:
Ian Lance Taylor 2010-12-22 16:21:06 +00:00
parent 1d9fa70c34
commit 480cc89916
2 changed files with 14 additions and 5 deletions
gcc/go/gofrontend

@ -299,6 +299,19 @@ Temporary_statement::type() const
return this->type_ != NULL ? this->type_ : this->init_->type();
}
// Return the tree for the temporary variable.
tree
Temporary_statement::get_decl() const
{
if (this->decl_ == NULL)
{
gcc_assert(saw_errors());
return error_mark_node;
}
return this->decl_;
}
// Traversal.
int

@ -487,11 +487,7 @@ class Temporary_statement : public Statement
// Return the tree for the temporary variable itself. This should
// not be called until after the statement itself has been expanded.
tree
get_decl() const
{
gcc_assert(this->decl_ != NULL);
return this->decl_;
}
get_decl() const;
protected:
int