Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccgo: should accept method recv base type that is alias to a pointer type #28252

Closed
griesemer opened this issue Oct 17, 2018 · 3 comments
Closed
Milestone

Comments

@griesemer
Copy link
Contributor

Per #27995, this code should be accepted:

package p

type T struct{}

type T1 = *T

func (T1) m() {}

func _() {
	(&T{}).m()
}

Right now we get:

$ gccgo x.go
x.go:7:7: error: invalid receiver type (receiver must be a named type)
7 | func (T1) m() {}
  |       ^
x.go:10:8: error: reference to undefined field or method 'm'
10 |  (&T{}).m()
   |        ^

cmd/compile accepts it.

@griesemer griesemer added this to the Gccgo milestone Oct 17, 2018
@benshi001
Copy link
Member

duplicate to #27994 ??

@ianlancetaylor
Copy link
Contributor

@benshi001 Similar, but #27994 is about a compiler crash and this issue is about failing to compile valid code.

@gopherbot
Copy link

Change https://golang.org/cl/160077 mentions this issue: compiler: fix a bug in go method's receiver type check

kraj pushed a commit to kraj/gcc that referenced this issue Jan 30, 2019
    
    Fixes golang/go#28252.
    
    Reviewed-on: https://go-review.googlesource.com/c/160077


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268397 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Jan 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants