2020-10-22 14:11:16 -06:00
|
|
|
// run
|
|
|
|
|
|
|
|
// Copyright 2020 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.
|
|
|
|
|
2022-09-01 17:31:04 -06:00
|
|
|
//go:build cgo
|
2022-08-07 11:14:43 -06:00
|
|
|
|
2020-10-22 14:11:16 -06:00
|
|
|
package main
|
|
|
|
|
2022-08-07 11:14:43 -06:00
|
|
|
import "runtime/cgo"
|
|
|
|
|
2020-10-22 14:11:16 -06:00
|
|
|
type NIH struct {
|
2022-08-07 11:14:43 -06:00
|
|
|
_ cgo.Incomplete
|
2020-10-22 14:11:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type T struct {
|
|
|
|
x *NIH
|
|
|
|
p *int
|
|
|
|
}
|
|
|
|
|
|
|
|
var y NIH
|
|
|
|
var z int
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
a := []T{{&y, &z}}
|
|
|
|
a = append(a, T{&y, &z})
|
|
|
|
if a[1].x == nil {
|
|
|
|
panic("pointer not written")
|
|
|
|
}
|
|
|
|
}
|