test/fixedbugs/bug028.go
raw| 1 | // run |
| 2 | |
| 3 | // Copyright 2009 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | package main |
| 8 | |
| 9 | |
| 10 | func Alloc(i int) int { |
| 11 | switch i { |
| 12 | default: |
| 13 | return 5; |
| 14 | case 1: |
| 15 | return 1; |
| 16 | case 10: |
| 17 | return 10; |
| 18 | } |
| 19 | return 0 |
| 20 | } |
| 21 | |
| 22 | func main() { |
| 23 | s := Alloc(7); |
| 24 | if s != 5 { panic("bad") } |
| 25 | } |
| 26 | |
| 27 | /* |
| 28 | bug028.go:7: unreachable statements in a switch |
| 29 | */ |