summaryrefslogtreecommitdiff
path: root/test/chan
diff options
context:
space:
mode:
authorNigel Tao <nigeltao@golang.org>2011-07-18 15:54:11 +1000
committerNigel Tao <nigeltao@golang.org>2011-07-18 15:54:11 +1000
commit0b47addb446556e42ec1163af0f6990dab277dad (patch)
treeb8580b7b71561ee09641eed40a0db7883040c892 /test/chan
parenta5ce83d2ce6fe56c0b7de0158c9d900bd57f7cbf (diff)
downloadgo-0b47addb446556e42ec1163af0f6990dab277dad.tar.gz
runtime: fix panic for make(chan [0]byte).
I suspect that this was introduced by http://code.google.com/p/go/source/detail?r=6e4ee32fffd1 R=r CC=golang-dev http://codereview.appspot.com/4764045
Diffstat (limited to 'test/chan')
-rw-r--r--test/chan/zerosize.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/chan/zerosize.go b/test/chan/zerosize.go
new file mode 100644
index 000000000..617c9dab3
--- /dev/null
+++ b/test/chan/zerosize.go
@@ -0,0 +1,16 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Making channels of a zero-sized type should not panic.
+
+package main
+
+func main() {
+ _ = make(chan [0]byte)
+ _ = make(chan [0]byte, 1)
+ _ = make(chan struct{})
+ _ = make(chan struct{}, 1)
+}