diff options
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 2914826..322f600 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -3811,6 +3811,14 @@ c_parser_statement_after_labels (c_parser *parser) break; default: expr_stmt: + if (c_parser_next_token_starts_declspecs (parser)) + { + error ("a label can only be part of a statement and a declaration is not a statement"); + c_parser_declaration_or_fndef (parser, /*fndef_ok*/ false, + /*nested*/ true, /*empty_ok*/ false, + /*start_attr_ok*/ true); + return; + } stmt = c_finish_expr_stmt (c_parser_expression_conv (parser).value); expect_semicolon: c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>"); |