| // $G $D/$F.go && $L $F.$A && ./$A.out >/dev/null 2>&1 || echo BUG: bug206 |
| // 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. |
| func g(list []ast.Expr) { |
| println(list[n].Pos().Line); |
| // f is the same as g except that the expression assigned to n is inlined. |
| func f(list []ast.Expr) { |
| println(list[len(list)-1 /* n */].Pos().Line); |
| list := []ast.Expr{&ast.Ident{}}; |
| throw: index out of range |
| throw+0x33 /home/gri/go/src/pkg/runtime/runtime.c:71 |
| sys·throwindex+0x1c /home/gri/go/src/pkg/runtime/runtime.c:45 |
| main·f+0x26 /home/gri/go/test/bugs/bug206.go:16 |
| main·main+0xc3 /home/gri/go/test/bugs/bug206.go:23 |
| mainstart+0xf /home/gri/go/src/pkg/runtime/amd64/asm.s:55 |
| goexit /home/gri/go/src/pkg/runtime/proc.c:133 |