]> Cypherpunks repositories - gostls13.git/commitdiff
Bug involving ... initializers and interface values.
authorAustin Clements <aclements@csail.mit.edu>
Wed, 12 Aug 2009 20:57:05 +0000 (13:57 -0700)
committerAustin Clements <aclements@csail.mit.edu>
Wed, 12 Aug 2009 20:57:05 +0000 (13:57 -0700)
R=rsc
APPROVED=rsc
DELTA=22  (22 added, 0 deleted, 0 changed)
OCL=33053
CL=33104

test/bugs/bug187.go [new file with mode: 0644]
test/golden.out

diff --git a/test/bugs/bug187.go b/test/bugs/bug187.go
new file mode 100644 (file)
index 0000000..8e7e14a
--- /dev/null
@@ -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++;
+       }
+}
index 9875907dc6b23a086e31312937bbf4aec2eb3240..16c16bbe5a39b91953361143749ac7c9f69585d4 100644 (file)
@@ -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
+