2012-02-17 04:48:57 +00:00
|
|
|
// run
|
2008-06-06 23:56:18 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
2009-01-20 22:40:40 +00:00
|
|
|
func Alloc(i int) int {
|
2008-06-06 23:56:18 +00:00
|
|
|
switch i {
|
|
|
|
default:
|
|
|
|
return 5;
|
|
|
|
case 1:
|
|
|
|
return 1;
|
|
|
|
case 10:
|
|
|
|
return 10;
|
|
|
|
}
|
2008-09-11 22:48:42 +00:00
|
|
|
return 0
|
2008-06-06 23:56:18 +00:00
|
|
|
}
|
|
|
|
|
2008-06-18 20:06:09 +00:00
|
|
|
func main() {
|
|
|
|
s := Alloc(7);
|
2008-08-12 05:07:49 +00:00
|
|
|
if s != 5 { panic("bad") }
|
2008-06-18 20:06:09 +00:00
|
|
|
}
|
|
|
|
|
2008-06-06 23:56:18 +00:00
|
|
|
/*
|
|
|
|
bug028.go:7: unreachable statements in a switch
|
|
|
|
*/
|