summaryrefslogtreecommitdiff
path: root/test/live.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/live.go')
-rw-r--r--test/live.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/live.go b/test/live.go
index 286fcc306..b4cced47e 100644
--- a/test/live.go
+++ b/test/live.go
@@ -4,6 +4,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// liveness tests with inlining disabled.
+// see also live2.go.
+
package main
func f1() {
@@ -590,3 +593,32 @@ func f39c() (x [10]*int) {
println() // ERROR "live at call to printnl: x"
return
}
+
+// issue 8142: lost 'addrtaken' bit on inlined variables.
+// no inlining in this test, so just checking that non-inlined works.
+
+type T40 struct {
+ m map[int]int
+}
+
+func newT40() *T40 {
+ ret := T40{ // ERROR "live at call to makemap: &ret"
+ make(map[int]int),
+ }
+ return &ret
+}
+
+func bad40() {
+ t := newT40()
+ println()
+ _ = t
+}
+
+func good40() {
+ ret := T40{ // ERROR "live at call to makemap: ret"
+ make(map[int]int),
+ }
+ t := &ret
+ println() // ERROR "live at call to printnl: ret"
+ _ = t
+}