diff options
author | Russ Cox <rsc@golang.org> | 2011-10-13 16:58:04 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-10-13 16:58:04 -0400 |
commit | f58ed4e64126b595efbde9df04e63c7ea2a4fbd6 (patch) | |
tree | 96948e47d2e0751de6c51e6d941ed8defaf70fc6 /test/closedchan.go | |
parent | d65aaf24a6f7c4752aa5609f3f40433218483e72 (diff) | |
download | go-f58ed4e64126b595efbde9df04e63c7ea2a4fbd6.tar.gz go-f58ed4e64126b595efbde9df04e63c7ea2a4fbd6.zip |
gc: disallow close on receive-only channels
Fixes #2353.
Fixes #2246.
R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5282042
Diffstat (limited to 'test/closedchan.go')
-rw-r--r-- | test/closedchan.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/closedchan.go b/test/closedchan.go index 95314b3345..0dbe662d84 100644 --- a/test/closedchan.go +++ b/test/closedchan.go @@ -327,4 +327,15 @@ func main() { testclosed(mk(closedasync())) } } + + var ch chan int + shouldPanic(func() { + close(ch) + }) + + ch = make(chan int) + close(ch) + shouldPanic(func() { + close(ch) + }) } |