LEFT | RIGHT |
(Both sides are equal) |
1 // errorcheck -0 -m -l | 1 // errorcheck -0 -m -l |
2 | 2 |
3 // Copyright 2010 The Go Authors. All rights reserved. | 3 // Copyright 2010 The Go Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style | 4 // Use of this source code is governed by a BSD-style |
5 // license that can be found in the LICENSE file. | 5 // license that can be found in the LICENSE file. |
6 | 6 |
7 // Test, using compiler diagnostic flags, that the escape analysis is working. | 7 // Test, using compiler diagnostic flags, that the escape analysis is working. |
8 // Compiles but does not run. Inlining is disabled. | 8 // Compiles but does not run. Inlining is disabled. |
9 | 9 |
10 // escape2n.go contains all the same tests but compiles with -N. | 10 // escape2n.go contains all the same tests but compiles with -N. |
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 | 1485 |
1486 func f() (x int, y *int) { // ERROR "moved to heap: x" | 1486 func f() (x int, y *int) { // ERROR "moved to heap: x" |
1487 y = &x // ERROR "&x escapes to heap" | 1487 y = &x // ERROR "&x escapes to heap" |
1488 return | 1488 return |
1489 } | 1489 } |
1490 | 1490 |
1491 func g() (x interface{}) { // ERROR "moved to heap: x" | 1491 func g() (x interface{}) { // ERROR "moved to heap: x" |
1492 x = &x // ERROR "&x escapes to heap" | 1492 x = &x // ERROR "&x escapes to heap" |
1493 return | 1493 return |
1494 } | 1494 } |
LEFT | RIGHT |