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