diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-25 16:35:24 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-25 16:35:24 +0000 |
commit | 5202d98629b534b72a22293124b527f3281573f6 (patch) | |
tree | c10e4945a3688d1e9989fda3872cb8d6ba04f4e3 /gcc/go | |
parent | 19b8522371c22f5f3edbf9b0e6f39c533d6ae3ef (diff) | |
download | gcc-5202d98629b534b72a22293124b527f3281573f6.tar.gz |
Don't permit close of receive-only channel.
Better panic on attempt to close nil channel.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180437 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 180279efac6..cdf2bad09f3 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -8153,6 +8153,8 @@ Builtin_call_expression::do_check_types(Gogo*) { 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; |