mirror of https://github.com/golang/go.git
cmd/compile: add failing test case for #24305
Updates #24305 Change-Id: Ib0b093e33004a978467cdd1e77186798392d4eca Reviewed-on: https://go-review.googlesource.com/c/go/+/248217 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
82c45eb681
commit
948d324f7d
|
|
@ -179,6 +179,13 @@ func _() {
|
||||||
u.N()
|
u.N()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fbad24305() {
|
||||||
|
// BAD u should not be heap allocated
|
||||||
|
var u U // ERROR "moved to heap: u"
|
||||||
|
(*U).M(&u)
|
||||||
|
(*U).N(&u)
|
||||||
|
}
|
||||||
|
|
||||||
// Issue 24730: taking address in a loop causes unnecessary escape
|
// Issue 24730: taking address in a loop causes unnecessary escape
|
||||||
type T24730 struct {
|
type T24730 struct {
|
||||||
x [64]byte
|
x [64]byte
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue