aboutsummaryrefslogtreecommitdiff
path: root/test/fixedbugs/issue59572.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixedbugs/issue59572.go')
-rw-r--r--test/fixedbugs/issue59572.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/fixedbugs/issue59572.go b/test/fixedbugs/issue59572.go
new file mode 100644
index 0000000000..a16817aec0
--- /dev/null
+++ b/test/fixedbugs/issue59572.go
@@ -0,0 +1,30 @@
+// run
+
+// Copyright 2023 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 foo() {
+ println("foo")
+}
+
+func main() {
+ fn := foo
+ for _, fn = range list {
+ fn()
+ }
+}
+
+var list = []func(){
+ func() {
+ println("1")
+ },
+ func() {
+ println("2")
+ },
+ func() {
+ println("3")
+ },
+}