mirror of
https://github.com/golang/go
synced 2024-11-21 19:14:44 -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:
parent
4bfcfcf89f
commit
9b62461a8f
@ -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
25
test/chan/select4.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user