1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:11:22 -06:00
go/test/bugs/bug187.go
Russ Cox 66beb2fd3b fix bug187 not to crash
TBR=austin
DELTA=9  (4 added, 4 deleted, 1 changed)
OCL=33115
CL=33115
2009-08-12 14:54:15 -07:00

24 lines
486 B
Go

// 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.
// $G $D/$F.go && $L $F.$A && ./$A.out
package main
import "os"
func main() {
// This bug doesn't arise with [...]int, or []interface{} or [3]interface{}.
a := [...]interface{} { 1, 2, 3 };
n := 0;
bug := false;
for _, v := range a {
if v.(int) != n {
println("BUG:", n, v.(int));
os.Exit(0);
}
n++;
}
}