| Index: test/escape2.go |
| =================================================================== |
| --- a/test/escape2.go |
| +++ b/test/escape2.go |
| @@ -1065,3 +1065,34 @@ |
| goto L1 |
| _ = i |
| } |
| + |
| +func foo124(x **int) { // ERROR "does not escape" |
|
rsc
2012/04/23 19:42:29
Please put the variable names in these patterns, l
|
| + var i int // ERROR "moved to heap" |
| + p := &i // ERROR "&i escapes" |
| + func() { // ERROR "does not escape" |
| + *x = p // ERROR "leaking closure reference" |
| + }() |
| +} |
| + |
| +func foo125(ch chan *int) { // ERROR "does not escape" |
|
rsc
2012/04/23 19:42:29
Please make a foo125a variant with defer func inst
|
| + var i int // ERROR "moved to heap" |
| + p := &i // ERROR "&i escapes" |
| + func() { // ERROR "does not escape" |
| + ch <- p // ERROR "leaking closure reference" |
| + }() |
| +} |
| + |
| +func foo126() { |
| + var px *int // loopdepth 0 |
| + for { |
| + // loopdepth 1 |
| + var i int // ERROR "moved to heap" |
| + // px = &i // would escape i-> should move to heap, as should the one below |
|
rsc
2012/04/23 19:42:29
Confusing. Delete.
|
| + func() { // ERROR "func literal does not escape" |
| + px = &i // ERROR "&i escapes" |
| + }() |
| + } |
| + |
| +} |
| + |
| + |