Source file test/fixedbugs/issue77534.go

     1  // compile
     2  
     3  // Copyright 2026 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Issue 77534: compiler crash when >4 fields, but only one nonempty pointer field.
     8  
     9  package p
    10  
    11  type T struct {
    12  	a, b, c, d struct{}
    13  	e          *byte
    14  }
    15  
    16  func f1(p *any, t T) {
    17  	*p = t
    18  }
    19  
    20  func f2(p *any, t *T) {
    21  	*p = *t
    22  }
    23  
    24  func f3(p, x, y *T, b bool) {
    25  	var z T
    26  	if b {
    27  		z = *x
    28  	} else {
    29  		z = *y
    30  	}
    31  	*p = z
    32  }
    33  
    34  func f4(i any) T {
    35  	return i.(T)
    36  }
    37  

View as plain text