1// compile 2 3// Copyright 2017 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 7// Verify that gotos across non-variable declarations 8// are accepted. 9 10package p 11 12func f1() { 13 goto L1 14 const x = 0 15L1: 16 goto L2 17 type T int 18L2: 19} 20 21func f2() { 22 { 23 goto L1 24 } 25 const x = 0 26L1: 27 { 28 goto L2 29 } 30 type T int 31L2: 32} 33 34func f3(d int) { 35 if d > 0 { 36 goto L1 37 } else { 38 goto L2 39 } 40 const x = 0 41L1: 42 switch d { 43 case 1: 44 goto L3 45 case 2: 46 default: 47 goto L4 48 } 49 type T1 int 50L2: 51 const y = 1 52L3: 53 for d > 0 { 54 if d < 10 { 55 goto L4 56 } 57 } 58 type T2 int 59L4: 60 select { 61 default: 62 goto L5 63 } 64 type T3 int 65L5: 66} 67