aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/go/gofrontend/statements.cc13
-rw-r--r--gcc/go/gofrontend/statements.h6
2 files changed, 14 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 047045c..fcc16d1 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -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
diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h
index 6ca586f..80cdffe 100644
--- a/gcc/go/gofrontend/statements.h
+++ b/gcc/go/gofrontend/statements.h
@@ -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