summaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-25 16:35:24 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-25 16:35:24 +0000
commit5202d98629b534b72a22293124b527f3281573f6 (patch)
treec10e4945a3688d1e9989fda3872cb8d6ba04f4e3 /gcc/go
parent19b8522371c22f5f3edbf9b0e6f39c533d6ae3ef (diff)
downloadgcc-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.cc2
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;