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