Files
golang.go/test/fixedbugs/issue77534.go
Keith Randall 1aa534dbb8 cmd/compile: ensure StructMake/ArrayMake1 of direct interfaces are unwrapped
Ensures that deeply nested structs that have the underlying shape
of a pointer get unwrapped properly.

Update #77534

Change-Id: I004f424d2c62ec7026281daded9b3d96c021e2e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/747760
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2026-02-25 13:58:41 -08:00

56 lines
709 B
Go

// compile
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 77534: compiler crash when >4 fields, but only one nonempty pointer field.
package p
type T struct {
a, b, c, d struct{}
e *byte
}
func f1(p *any, t T) {
*p = t
}
func f2(p *any, t *T) {
*p = *t
}
func f3(p, x, y *T, b bool) {
var z T
if b {
z = *x
} else {
z = *y
}
*p = z
}
func f4(i any) T {
return i.(T)
}
type Inner struct {
a struct{}
p *byte
}
type Outer struct {
inner Inner
}
func f5(o1, o2 Outer, c bool) Outer {
var i any
if c {
i = o1
} else {
i = o2
}
return i.(Outer)
}