1 // $G $D/$F.go && $L $F.$A && ./$A.out >/dev/null 2>&1 || echo BUG: bug206
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
11 func g(list
[]ast
.Expr
) {
13 println(list
[n
].Pos().Line
);
17 // f is the same as g except that the expression assigned to n is inlined.
18 func f(list
[]ast
.Expr
) {
20 println(list
[len(list
)-1 /* n */].Pos().Line
);
25 list
:= []ast
.Expr
{&ast
.Ident
{}};
26 g(list
); // this works
27 f(list
); // this doesn't
33 throw: index out of range
36 throw+0x33 /home/gri/go/src/pkg/runtime/runtime.c:71
38 sys·throwindex+0x1c /home/gri/go/src/pkg/runtime/runtime.c:45
40 main·f+0x26 /home/gri/go/test/bugs/bug206.go:16
42 main·main+0xc3 /home/gri/go/test/bugs/bug206.go:23
44 mainstart+0xf /home/gri/go/src/pkg/runtime/amd64/asm.s:55
46 goexit /home/gri/go/src/pkg/runtime/proc.c:133