3 // Copyright 2015 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.
7 // Check that these do not use "by value" capturing,
8 // because changes are made to the value during the closure.
44 for z.a[1] = 1; i < 10; i++ {
61 tmp = w // force capture of w, but do not write to it yet
65 w++ // write in a nested closure
74 for i := range [2]int{} {
77 return i // test that we capture by ref here, i is mutated on every interaction
92 return q // test that we capture by ref here
93 // q++ must on a different decldepth than q declaration
108 }()] = range [2]int{} {
110 return q // test that we capture by ref here
111 // q++ must on a different decldepth than q declaration