Source file test/fixedbugs/issue42032.go

     1  // run
     2  
     3  // Copyright 2020 The Go Authors. All rights reserved.  Use of this
     4  // source code is governed by a BSD-style license that can be found in
     5  // the LICENSE file.
     6  
     7  //go:build cgo
     8  
     9  package main
    10  
    11  import "runtime/cgo"
    12  
    13  type NIH struct {
    14  	_ cgo.Incomplete
    15  }
    16  
    17  type T struct {
    18  	x *NIH
    19  	p *int
    20  }
    21  
    22  var y NIH
    23  var z int
    24  
    25  func main() {
    26  	a := []T{{&y, &z}}
    27  	a = append(a, T{&y, &z})
    28  	if a[1].x == nil {
    29  		panic("pointer not written")
    30  	}
    31  }
    32  

View as plain text