Skip to content

Give better error message for named pointer receiver types #1680

@gjemiller

Description

@gjemiller
The following program errors out with a message "invalid receiver type MyPtr".
 Because the C typedefs were done in someone else's header, I hadn't realized that btype
was a pointer type.  Something more helpful might be "MyPtr: named pointer types
may not be receivers"


1. What is a short input program that triggers the error?

package mine

// typedef int atype;
// typedef void* btype;
import "C"


type MyInt C.atype
type MyPtr C.btype


func (m MyInt) DoSomething() {

}

func (m MyPtr) DoSomethingElse() {

}


// http://pastie.org/private/hwxyxvyb0zn9sesbwjpnq

2. What is the full compiler output?
# make (with a standard cgo makefile)
CGOPKGPATH= cgo --  cgo.go 
touch _obj/_cgo_run
6g -o _go_.6  _obj/cgo.cgo1.go _obj/_cgo_gotypes.go
cgo.go:12[_obj/cgo.cgo1.go:15]: invalid receiver type MyPtr
make: *** [_go_.6] Error 1


3. What version of the compiler are you using?  (Run it with the -V flag.)
6g version release.2011-03-07.1 7666+ (but really I think it's cgo)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions