aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/parser.cc')
-rw-r--r--gcc/cp/parser.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index f5f9f5a..dd3665c8 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -21028,11 +21028,13 @@ cp_parser_enum_specifier (cp_parser* parser)
/* Check for the `:' that denotes a specified underlying type in C++0x.
Note that a ':' could also indicate a bitfield width, however. */
+ location_t colon_loc = UNKNOWN_LOCATION;
if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
{
cp_decl_specifier_seq type_specifiers;
/* Consume the `:'. */
+ colon_loc = cp_lexer_peek_token (parser->lexer)->location;
cp_lexer_consume_token (parser->lexer);
auto tdf
@@ -21081,10 +21083,13 @@ cp_parser_enum_specifier (cp_parser* parser)
&& cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
{
if (has_underlying_type)
- cp_parser_commit_to_tentative_parse (parser);
- cp_parser_error (parser, "expected %<;%> or %<{%>");
- if (has_underlying_type)
- return error_mark_node;
+ pedwarn (colon_loc,
+ OPT_Welaborated_enum_base,
+ "declaration of enumeration with "
+ "fixed underlying type and no enumerator list is "
+ "only permitted as a standalone declaration");
+ else
+ cp_parser_error (parser, "expected %<;%> or %<{%>");
}
}