2011-10-14 Jason Merrill <jason@redhat.com>
+ PR c++/50563
+ * parser.c (cp_parser_cache_group): Handle end==CPP_COMMA.
+ (cp_parser_save_nsdmi): Pass it.
+
PR c++/50507
* method.c (walk_field_subobs): Check for NSDMI before
complaining about uninitialized fields.
cp_token *last;
tree node;
- cp_parser_cache_group (parser, CPP_CLOSE_PAREN, /*depth=*/0);
+ /* Save tokens until the next comma or semicolon. */
+ cp_parser_cache_group (parser, CPP_COMMA, /*depth=*/0);
last = parser->lexer->next_token;
kind of syntax error. */
return true;
+ /* If we're caching something finished by a comma (or semicolon),
+ such as an NSDMI, don't consume the comma. */
+ if (end == CPP_COMMA
+ && (token->type == CPP_SEMICOLON || token->type == CPP_COMMA))
+ return false;
+
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
/* See if it starts a new group. */