Commit 480cc899 by Ian Lance Taylor

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

From-SVN: r168173
parent 1d9fa70c
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment