-
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: use of untyped nil in switch #11668
Comments
@griesemer to judge compiler disagreement |
As far as I can tell, the spec doesn't say what should happen if the switch expression is untyped. E.g., cmd/compile seems to apply the implicit typing logic from section "Variable declarations" (i.e., use the default type for untyped constants, and reject untyped nil). |
@mdempsky is correct. That said, we know that the spec is underspecified when it comes to the switch statement. I believe that nil could be permitted, but I am not feeling strongly about it. I think we need to nail down the spec issue first. |
A similar case: func f() {
switch 1<<100 {
}
} gotype compiles without errors, gc says |
This is related to #6398. |
CL https://golang.org/cl/12711 mentions this issue. |
Per https://golang.org/cl/12711 this program is incorrect and gc correctly reports an error. |
@griesemer should we file a bug on go/types? |
@dvyukov this is already fixed in https://go-review.googlesource.com/#/c/12713/ (for 1.6) |
gc fails on the following program:
The program is correct and must be compiled without errors.
go version devel +9b04852 Sat Jul 11 00:08:50 2015 +0000 linux/amd64
The text was updated successfully, but these errors were encountered: