sink = v1
}
{
- i := 0 // ERROR "moved to heap: i"
+ i := 0
v := M0{&i}
- // BAD: v does not escape to heap here
var x M = v
- x.M()
+ x.M() // ERROR "devirtualizing x.M"
}
{
i := 0 // ERROR "moved to heap: i"
sink = v1 // ERROR "v1 escapes to heap"
}
{
- i := 0 // ERROR "moved to heap: i"
+ i := 0
v := M1{&i, 0}
- // BAD: v does not escape to heap here
- var x M = v // ERROR "v escapes to heap"
- x.M()
+ var x M = v // ERROR "v does not escape"
+ x.M() // ERROR "devirtualizing x.M"
}
{
i := 0 // ERROR "moved to heap: i"
_ = ok
}
{
- i := 0 // ERROR "moved to heap: i"
- v := &M2{&i} // ERROR "&M2{...} escapes to heap"
- // BAD: v does not escape to heap here
+ i := 0
+ v := &M2{&i} // ERROR "&M2{...} does not escape"
var x M = v
- x.M()
+ x.M() // ERROR "devirtualizing x.M"
}
{
i := 0 // ERROR "moved to heap: i"
*(&v) = x.(int)
*(&v), *(&ok) = y.(int)
}
- {
+ { // #13805, #15796
i := 0
j := 0
var ok bool
var x interface{} = i // ERROR "i does not escape"
var y interface{} = j // ERROR "j does not escape"
- sink = x.(int) // ERROR "x.\(int\) escapes to heap"
- sink, *(&ok) = y.(int)
+ sink = x.(int) // ERROR "x.\(int\) escapes to heap"
+ sink, *(&ok) = y.(int) // ERROR "autotmp_.* escapes to heap"
}
{
i := 0 // ERROR "moved to heap: i"
sink, *(&ok) = y.(*int)
}
}
+
+func issue42279() {
+ type I interface{ M() }
+ type T struct{ I }
+
+ var i I = T{} // ERROR "T\{\} does not escape"
+ i.M() // ERROR "partially devirtualizing i.M to T"
+}