aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-08-31 17:08:33 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-08-31 17:08:33 -0400
commitc8affb455c7c4816a57abdba5afc3fcdf5b5115f (patch)
treeb537b9171c36f4e0dd6e65827429225942e5633d /gcc/cp
parente74f1cc83c20eff2e1d0f9b3363075a1d7fd6a78 (diff)
downloadgcc-c8affb455c7c4816a57abdba5afc3fcdf5b5115f.zip
gcc-c8affb455c7c4816a57abdba5afc3fcdf5b5115f.tar.gz
gcc-c8affb455c7c4816a57abdba5afc3fcdf5b5115f.tar.bz2
re PR c++/41127 (unnamed bitfield declaration parser regression)
PR c++/41127 * parser.c (cp_parser_enum_specifier): Make sure the : is followed by a type-specifier-seq before we commit. From-SVN: r151246
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c17
2 files changed, 15 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 90a5c59..78d075e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-31 Jason Merrill <jason@redhat.com>
+
+ PR c++/41127
+ * parser.c (cp_parser_enum_specifier): Make sure the : is followed by a
+ type-specifier-seq before we commit.
+
2009-08-28 Richard Guenther <rguenther@suse.de>
PR lto/41058
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index a3e9f0e..64869cd 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -11967,11 +11967,19 @@ cp_parser_enum_specifier (cp_parser* parser)
else
identifier = make_anon_name ();
- /* Check for the `:' that denotes a specified underlying type in C++0x. */
+ /* Check for the `:' that denotes a specified underlying type in C++0x.
+ Note that a ':' could also indicate a bitfield width, however. */
if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
{
cp_decl_specifier_seq type_specifiers;
+ /* Consume the `:'. */
+ cp_lexer_consume_token (parser->lexer);
+
+ /* Parse the type-specifier-seq. */
+ cp_parser_type_specifier_seq (parser, /*is_condition=*/false,
+ &type_specifiers);
+
/* At this point this is surely not elaborated type specifier. */
if (!cp_parser_parse_definitely (parser))
return NULL_TREE;
@@ -11979,15 +11987,8 @@ cp_parser_enum_specifier (cp_parser* parser)
if (cxx_dialect == cxx98)
maybe_warn_cpp0x ("scoped enums");
- /* Consume the `:'. */
- cp_lexer_consume_token (parser->lexer);
-
has_underlying_type = true;
- /* Parse the type-specifier-seq. */
- cp_parser_type_specifier_seq (parser, /*is_condition=*/false,
- &type_specifiers);
-
/* If that didn't work, stop. */
if (type_specifiers.type != error_mark_node)
{