1// run 2//go:build cgo 3 4// Copyright 2021 The Go Authors. All rights reserved. 5// Use of this source code is governed by a BSD-style 6// license that can be found in the LICENSE file. 7 8package main 9 10import "runtime/cgo" 11 12type A struct { 13 B 14 _ cgo.Incomplete 15} 16type B struct{ x byte } 17type I interface{ M() *B } 18 19func (p *B) M() *B { return p } 20 21var ( 22 a A 23 i I = &a 24) 25 26func main() { 27 got, want := i.M(), &a.B 28 if got != want { 29 println(got, "!=", want) 30 panic("FAIL") 31 } 32} 33