Fix handling of abstract types in temporary statements.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 4 Jan 2011 19:02:47 +0000 (19:02 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 4 Jan 2011 19:02:47 +0000 (19:02 +0000)
From-SVN: r168480

gcc/go/gofrontend/statements.cc

index ef34bba174bd48cc1480a512c9619a70edf164f4..d8ea9f0682a2f0186853077643ead3125f89ad93 100644 (file)
@@ -340,6 +340,9 @@ Temporary_statement::do_traverse_assignments(Traverse_assignments* tassign)
 void
 Temporary_statement::do_determine_types()
 {
+  if (this->type_ != NULL && this->type_->is_abstract())
+    this->type_ = this->type_->make_non_abstract_type();
+
   if (this->init_ != NULL)
     {
       if (this->type_ == NULL)
@@ -352,10 +355,10 @@ Temporary_statement::do_determine_types()
     }
 
   if (this->type_ == NULL)
-    this->type_ = this->init_->type();
-
-  if (this->type_->is_abstract())
-    this->type_ = this->type_->make_non_abstract_type();
+    {
+      this->type_ = this->init_->type();
+      gcc_assert(!this->type_->is_abstract());
+    }
 }
 
 // Check types.