Don't crash on tuple initialization from erroneous channel.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 15 Dec 2010 23:50:02 +0000 (23:50 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 15 Dec 2010 23:50:02 +0000 (23:50 +0000)
From-SVN: r167882

gcc/go/gofrontend/gogo.cc

index 39072e075b1f7a0be2e15ac7e16426a51fdbae03..b27871132e33b7ac0ef7d83bf3776c3fa7659cbc 100644 (file)
@@ -3126,7 +3126,10 @@ Variable::type_from_tuple(Expression* expr, bool report_error) const
   else if (expr->receive_expression() != NULL)
     {
       Expression* channel = expr->receive_expression()->channel();
-      return channel->type()->channel_type()->element_type();
+      Type* channel_type = channel->type();
+      if (channel_type->is_error_type())
+       return Type::make_error_type();
+      return channel_type->channel_type()->element_type();
     }
   else
     {