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

cmd/gc: disallow fallthrough in final case of switch #4924

Closed
rsc opened this issue Feb 26, 2013 · 4 comments
Closed

cmd/gc: disallow fallthrough in final case of switch #4924

rsc opened this issue Feb 26, 2013 · 4 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Feb 26, 2013

The spec disallows a "fallthrough" statement in the final case of a switch,
but 6g and friends allow it. Fix this. See also issue #4923.
@gopherbot
Copy link
Contributor

Comment 1 by tylerbunnell:

I'm currently looking in to this issue. I have a solution in place. I run all the tests
in $GOROOT/test and I get this output:
switch.go:400: cannot fallthrough final case in switch
which is the error string I am throwing when a fallthrough is detected in the final
case. The error is correct, but I am not sure how to proceed with the test file itself.
As of now, it completely fails to compile, as it should, however, it seems like a bad
idea to simply remove the code entirely to make it build.
My question, then: is it possible for me to have the test expect this statement to fail
to compile? What would be the proper way to proceed and still have test coverage for
this particular case?
Thanks!

@gopherbot
Copy link
Contributor

Comment 2 by tylerbunnell:

Disregard the previous post. I figured it out. :)

@gopherbot
Copy link
Contributor

Comment 3 by tylerbunnell:

I've submitted a CL for this bug. Please see: https://golang.org/cl/7841043/

@rsc
Copy link
Contributor Author

rsc commented Mar 15, 2013

Comment 4:

Status changed to Fixed.

@rsc rsc added fixed labels Mar 15, 2013
@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@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

2 participants