Closed
Description
This program successfully runs with Go 1.21:
$ cat cgo_methods.go
package main
/*
typedef int foo;
*/
import "C"
type foo = C.foo
func (foo) method() int { return 123 }
func main() {
var x foo
println(x.method()) // "123"
}
$ go run cgo_methods.go
123
I believe this program is invalid for the same reason as the program in #57926. Note that in contrast to that issue, this program uses an alias to define a method on a C type.
Metadata
Metadata
Labels
Type
Projects
Status
Done