Test that a break statement inside a select statement breaks

out of the enclosing loop.

R=ken
DELTA=20  (20 added, 0 deleted, 0 changed)
OCL=18686
CL=18714
This commit is contained in:
Ian Lance Taylor 2008-11-06 15:24:10 -08:00
parent ec81145565
commit ce15158502
2 changed files with 24 additions and 0 deletions

20
test/bugs/bug119.go Normal file
View File

@ -0,0 +1,20 @@
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: should not fail
// Copyright 2009 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.
package main
func main() {
a := new(chan bool);
for {
select {
case <- a:
panic();
default:
break;
}
panic();
}
}

View File

@ -153,6 +153,10 @@ BUG: should compile
=========== bugs/bug118.go
BUG should compile
=========== bugs/bug119.go
panic on line 82 PC=xxx
BUG should not panic
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: overflow converting constant to uint