1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:57:56 -07:00

gc: allow select case expr = <-c

Fixes #1139.

R=ken2
CC=golang-dev
https://golang.org/cl/2194046
This commit is contained in:
Russ Cox 2010-09-27 12:04:21 -04:00
parent 4bfcfcf89f
commit 9b62461a8f
2 changed files with 26 additions and 1 deletions

View File

@ -461,7 +461,7 @@ case:
} }
break; break;
} }
| LCASE name '=' expr ':' | LCASE expr '=' expr ':'
{ {
// will be converted to OCASE // will be converted to OCASE
// right will point to next case // right will point to next case

25
test/chan/select4.go Normal file
View File

@ -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)
}
}
}