-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: accepts invalid comparisons against converted nil #13480
Comments
I'm not certain the behavior of EDIT: I'm agreeing with mdemsky. I just didn't realize it till now. |
@alandonovan Sorry, I'm not sure I follow your response. To clarify, the issue I'm trying to point out is that cmd/compile does compile the snippet of source I pasted without errors, whereas my understanding of the Go spec (and supported by gotype's behavior) says it should not. |
Also, surely it's a bug that cmd/compile and gotype differ in their opinion. What does gccgo say? |
Hi Matthew, sorry for the confusion. I clarified my response but of course that didn't send mail. I agree with you that |
Ah, okay. :) |
gccgo says:
|
CL https://golang.org/cl/17461 mentions this issue. |
cmd/compile accepts this source:
but gotype rejects it with:
The Go spec says "However, as a special case, a slice, map, or function value may be compared to the predeclared identifier
nil
." which seems to support gotype's behavior.The text was updated successfully, but these errors were encountered: