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: internal compiler error declaring method without body #27994
Comments
Follow-up. The crash disappears if there's a method body: $ cat x.go
package p
type T struct{}
type T1 = *T
func (T1) m() int { return 0 }
var _ = (&T{}).m() compiles with an error message:
|
As the spec states "A function declaration may omit the body. Such a declaration provides the signature for a function implemented outside Go, such as an assembly routine." I think it should be the same for methods without body. They are needed to allow implementation of methods in C or assembler. |
I will take a look. |
Change https://golang.org/cl/160459 mentions this issue: |
…ation Fixes golang/go#27994. Reviewed-on: https://go-review.googlesource.com/c/160459 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268450 138bc75d-0d04-0410-961f-82ee72b054a4
It's not clear that this code is permitted in the first place, but gccgo shouldn't crash.
cmd/compile accepts this. gccgo crashes (and go/types reports an error - no such method).
The crash also appears if T1 = T and the literal is just T{} rather than &T{}.
The text was updated successfully, but these errors were encountered: