1
0
mirror of https://github.com/golang/go synced 2024-11-14 13:50:23 -07:00
go/test/fixedbugs/issue49145.go
wdvxdr c6e82e5808 cmd/compile: fix inlining labeled switch statements
CL 357649 fixes inlining labeled FOR/RANGE loops,
we should do same translation for inlined SWITCH's label

Fixes #49145

Change-Id: I9a6f365f57e974271a1eb279b38e81f9b5148788
Reviewed-on: https://go-review.googlesource.com/c/go/+/358315
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-10-25 16:07:11 +00:00

28 lines
357 B
Go

// run
// Copyright 2021 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.
package main
func f(j int) {
loop:
switch j {
case 1:
break loop
default:
println(j)
}
}
func main() {
loop:
for j := 0; j < 5; j++ {
f(j)
if j == 3 {
break loop
}
}
}