aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/parse.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index 0a67bbe..5a9feb7 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -4523,9 +4523,12 @@ Parse::expr_case_clause(Case_clauses* clauses, bool* saw_default)
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)