aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-10-25 16:35:24 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-10-25 16:35:24 +0000
commit09367c0d60f551d7d05b6212b649a71636b623ce (patch)
treec10e4945a3688d1e9989fda3872cb8d6ba04f4e3 /gcc
parent0d53e34681bfbb0849726ee8d3b17cf330a33a76 (diff)
downloadgcc-09367c0d60f551d7d05b6212b649a71636b623ce.zip
gcc-09367c0d60f551d7d05b6212b649a71636b623ce.tar.gz
gcc-09367c0d60f551d7d05b6212b649a71636b623ce.tar.bz2
Don't permit close of receive-only channel.
Better panic on attempt to close nil channel. From-SVN: r180437
Diffstat (limited to 'gcc')
-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 180279e..cdf2bad 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;