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 9package main 10 11import "runtime/cgo" 12 13type NIH struct { 14 _ cgo.Incomplete 15} 16 17type T struct { 18 x *NIH 19 p *int 20} 21 22var y NIH 23var z int 24 25func 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