Source file test/fixedbugs/issue46903.go

     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  
     8  package main
     9  
    10  import "runtime/cgo"
    11  
    12  type A struct {
    13  	B
    14  	_ cgo.Incomplete
    15  }
    16  type B struct{ x byte }
    17  type I interface{ M() *B }
    18  
    19  func (p *B) M() *B { return p }
    20  
    21  var (
    22  	a A
    23  	i I = &a
    24  )
    25  
    26  func main() {
    27  	got, want := i.M(), &a.B
    28  	if got != want {
    29  		println(got, "!=", want)
    30  		panic("FAIL")
    31  	}
    32  }
    33  

View as plain text