In Go 1 the fallthrough statement is no longer permitted in the last case of a switch, as there is no code to which to fall through. This patch from Rémy Oudompheng implements this restriction in gccgo. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.8 branch.
Ian
diff -r 133fcbfa33c6 go/parse.cc --- a/go/parse.cc Wed Jun 26 15:31:30 2013 -0700 +++ b/go/parse.cc Wed Jun 26 15:44:23 2013 -0700 @@ -4523,9 +4523,12 @@ bool is_fallthrough = false; if (this->peek_token()->is_keyword(KEYWORD_FALLTHROUGH)) { + Location fallthrough_loc = this->location(); is_fallthrough = true; if (this->advance_token()->is_op(OPERATOR_SEMICOLON)) this->advance_token(); + if (this->peek_token()->is_op(OPERATOR_RCURLY)) + error_at(fallthrough_loc, _("cannot fallthrough final case in switch")); } if (is_default)