blob: 4a92624c7695e3d7ccfa9d65e11820c1b0859c15 [file] [log] [blame]
Russ Cox80803842012-02-16 23:49:59 -05001// errorcheck
Russ Cox5d9dbe12011-06-16 00:18:43 -04002
3// Copyright 2011 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.
6
7package main
8
9import "fmt"
10
11func main() {
12 // invalid use of goto.
13 // do whatever you like, just don't crash.
14 i := 42
15 a := []*int{&i, &i, &i, &i}
16 x := a[0]
Ian Lance Taylorf1aefc02011-09-20 14:45:54 -070017 goto start // ERROR "jumps into block"
Russ Cox7f4c5ea2011-06-17 15:25:05 -040018 z := 1
19 _ = z
Ian Lance Taylorf1aefc02011-09-20 14:45:54 -070020 for _, x = range a { // GCCGO_ERROR "block"
Russ Cox5d9dbe12011-06-16 00:18:43 -040021 start:
22 fmt.Sprint(*x)
23 }
24}