Message ID | mcr8vo9do6m.fsf@dhcp-172-18-216-180.mtv.corp.google.com |
---|---|
State | New |
Headers | show |
diff -r 4dea0e134ef6 go/expressions.cc --- a/go/expressions.cc Mon Oct 24 22:36:05 2011 -0700 +++ b/go/expressions.cc Tue Oct 25 09:07:49 2011 -0700 @@ -8153,6 +8153,8 @@ { if (this->one_arg()->type()->channel_type() == NULL) this->report_error(_("argument must be channel")); + else if (!this->one_arg()->type()->channel_type()->may_send()) + this->report_error(_("cannot close receive-only channel")); } break; diff -r 4dea0e134ef6 libgo/runtime/go-close.c --- a/libgo/runtime/go-close.c Mon Oct 24 22:36:05 2011 -0700 +++ b/libgo/runtime/go-close.c Tue Oct 25 09:07:49 2011 -0700 @@ -16,6 +16,9 @@ { int i; + if (channel == NULL) + __go_panic_msg ("close of nil channel"); + i = pthread_mutex_lock (&channel->lock); __go_assert (i == 0);