diff options
-rw-r--r-- | test/bugs/bug187.go | 19 | ||||
-rw-r--r-- | test/golden.out | 7 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/bugs/bug187.go b/test/bugs/bug187.go new file mode 100644 index 000000000..8e7e14a87 --- /dev/null +++ b/test/bugs/bug187.go @@ -0,0 +1,19 @@ +// 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 + +func main() { + // This bug doesn't arise with [...]int, or []interface{} or [3]interface{}. + a := [...]interface{} { 1, 2, 3 }; + n := 0; + for _, v := range a { + if v.(int) != n { + panicln("BUG:", n, v.(int)); + } + n++; + } +} diff --git a/test/golden.out b/test/golden.out index 9875907dc..16c16bbe5 100644 --- a/test/golden.out +++ b/test/golden.out @@ -153,3 +153,10 @@ BUG: should fail =========== bugs/bug169.go BUG: errchk: command succeeded unexpectedly + +=========== bugs/bug187.go +BUG: 0 1 +SIGSEGV: segmentation violation +Faulting address: 0x40a1f0 +PC=0x40a1f0 + |