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: Wrong computed promoted method set #4365

Closed
campoy opened this issue Nov 8, 2012 · 12 comments
Closed

gccgo: Wrong computed promoted method set #4365

campoy opened this issue Nov 8, 2012 · 12 comments

Comments

@campoy
Copy link
Contributor

campoy commented Nov 8, 2012

1. What is a short input program that triggers the error?
http://play.golang.org/p/TcBk21Mhr7

2. What is the full compiler output?
prog.go:16: Foo.M is a field, not a method
prog.go:16: cannot use Foo literal (type Foo) as type T in assignment:
    Foo does not implement T (missing M method)

3. What version of the compiler are you using?  (Run it with the -V flag.)
Running on the playground.
On my machine:
- go version go1.0.3 fails
@rsc
Copy link
Contributor

rsc commented Nov 8, 2012

Comment 1:

This looks like a great error. What's the problem?

@campoy
Copy link
Contributor Author

campoy commented Nov 8, 2012

Comment 2:

M is also a method, gri@ tested it on ggcgo and it compiles.
So this is either a gc bug or a gccgo one, in any case it seems there's a discrepancy

@ianlancetaylor
Copy link
Contributor

Comment 3:

Based on the current spec, I believe this is a bug in gccgo.  The spec says that the
method set of a struct includes all promoted methods, not all methods.  A promoted
method is a method M such that v.M denotes that method.  In this case v.M denotes the
embedded field, not the method.  So M should not be in the method set, and the
assignment should fail.
Of course we could decide that the spec is wrong, but I think the spec is plausible, and
it follows that gccgo is in error.
It would be great if you could add this test to the testsuite.

Labels changed: added priority-later, gccgo, removed priority-triage.

@campoy
Copy link
Contributor Author

campoy commented Nov 8, 2012

Comment 4:

I updated the summary to better match the problem based on rsc and gri comments.
How should I add this test to the testsuite? Also, if I add it it will fail and
according to the contribution guidelines I can't add a patch that introduces new errors,
therefore I'd need to fix the problem first. And I'm not sure it's worth spending time
for me going through the gccgo code at this time.

@ianlancetaylor
Copy link
Contributor

Comment 5:

Adding a test case to the gc testsuite will not cause the gccgo testsuite to fail.

@robpike
Copy link
Contributor

robpike commented May 19, 2013

Comment 6:

Labels changed: added go1.2, removed go1.1.

@robpike
Copy link
Contributor

robpike commented Aug 21, 2013

Comment 7:

Removing Go1.2 label, as these are not blocking the release.

Labels changed: removed go1.2.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 8:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 9:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 10:

Labels changed: added repo-gccgo.

@ianlancetaylor
Copy link
Contributor

Comment 11:

Fixed on tip.
https://golang.org/cl/147280043/

Status changed to Fixed.

@gopherbot
Copy link

Comment 12:

CL https://golang.org/cl/151410043 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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