Russ Cox | 0b477ef | 2012-02-16 23:48:57 -0500 | [diff] [blame] | 1 | // run |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 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 | |
Russ Cox | 839a684 | 2009-01-20 14:40:40 -0800 | [diff] [blame] | 10 | func Alloc(i int) int { |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 11 | switch i { |
| 12 | default: |
| 13 | return 5; |
| 14 | case 1: |
| 15 | return 1; |
| 16 | case 10: |
| 17 | return 10; |
| 18 | } |
Rob Pike | d6f15be | 2008-09-11 15:48:42 -0700 | [diff] [blame] | 19 | return 0 |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 20 | } |
| 21 | |
Rob Pike | 9b664c5 | 2008-06-18 13:06:09 -0700 | [diff] [blame] | 22 | func main() { |
| 23 | s := Alloc(7); |
Rob Pike | bc2f5f1 | 2008-08-11 22:07:49 -0700 | [diff] [blame] | 24 | if s != 5 { panic("bad") } |
Rob Pike | 9b664c5 | 2008-06-18 13:06:09 -0700 | [diff] [blame] | 25 | } |
| 26 | |
Rob Pike | 094ee44 | 2008-06-06 16:56:18 -0700 | [diff] [blame] | 27 | /* |
| 28 | bug028.go:7: unreachable statements in a switch |
| 29 | */ |