Text file src/cmd/go/testdata/script/cgo_badmethod_issue60725.txt

     1  [!cgo] skip
     2  
     3  # Test that cgo rejects attempts to declare methods
     4  # on the types A or *A; see issue #60725.
     5  
     6  ! go build ./a
     7  stderr 'cannot define new methods on non-local type A'
     8  stderr 'cannot define new methods on non-local type A'
     9  
    10  -- go.mod --
    11  module example.com
    12  go 1.24
    13  
    14  -- a/a.go --
    15  package a
    16  
    17  /*
    18  typedef int T;
    19  */
    20  import "C"
    21  
    22  type A = C.T
    23  
    24  func (A) m1() {}
    25  func (*A) m2() {}
    26  

View as plain text