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