aboutsummaryrefslogtreecommitdiff
path: root/test/chan
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-09-27 12:04:21 -0400
committerRuss Cox <rsc@golang.org>2010-09-27 12:04:21 -0400
commit9b62461a8f6b1df33c1d71211edd7c9652ebf16a (patch)
tree8cdd54520c0edf4e9b076f2bf83f7e00fbdb7226 /test/chan
parent4bfcfcf89f0aa756b3ad2a10130cda1a5ab62db3 (diff)
downloadgo-9b62461a8f6b1df33c1d71211edd7c9652ebf16a.tar.gz
go-9b62461a8f6b1df33c1d71211edd7c9652ebf16a.zip
gc: allow select case expr = <-c
Fixes #1139. R=ken2 CC=golang-dev https://golang.org/cl/2194046
Diffstat (limited to 'test/chan')
-rw-r--r--test/chan/select4.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/chan/select4.go b/test/chan/select4.go
new file mode 100644
index 0000000000..46618ac881
--- /dev/null
+++ b/test/chan/select4.go
@@ -0,0 +1,25 @@
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+package main
+
+func f() *int {
+ println("BUG: called f")
+ return new(int)
+}
+
+func main() {
+ var x struct {
+ a int
+ }
+ c := make(chan int, 1)
+ c1 := make(chan int)
+ c <- 42
+ select {
+ case *f() = <-c1:
+ // nothing
+ case x.a = <-c:
+ if x.a != 42 {
+ println("BUG:", x.a)
+ }
+ }
+}