re PR c++/55368 (Comma before semicolon in struct definition is not rejected)

/cp
2012-11-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55368
	* parser.c (cp_parser_member_declaration): Emit an error in case
	of stray comma at end of member declaration.

/testsuite
2012-11-19  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55368
	* g++.dg/parse/struct-5.C: New.

From-SVN: r193624
This commit is contained in:
Paolo Carlini 2012-11-19 14:41:26 +00:00
parent e252e96aae
commit 37f458dc1e
4 changed files with 25 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2012-11-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55368
* parser.c (cp_parser_member_declaration): Emit an error in case
of stray comma at end of member declaration.
2012-11-19 Jason Merrill <jason@redhat.com>
* class.c (one_inheriting_sig): Don't inherit base copy ctors.

View File

@ -19407,7 +19407,15 @@ cp_parser_member_declaration (cp_parser* parser)
parser->object_scope = NULL_TREE;
/* If it's a `,', then there are more declarators. */
if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
{
cp_lexer_consume_token (parser->lexer);
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
{
cp_token *token = cp_lexer_previous_token (parser->lexer);
error_at (token->location,
"stray %<,%> at end of member declaration");
}
}
/* If the next token isn't a `;', then we have a parse error. */
else if (cp_lexer_next_token_is_not (parser->lexer,
CPP_SEMICOLON))

View File

@ -1,3 +1,8 @@
2012-11-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55368
* g++.dg/parse/struct-5.C: New.
2012-11-19 Tom de Vries <tom@codesourcery.com>
PR rtl-optimization/55315
@ -13,8 +18,8 @@
-[2, 2] and -[3, 3] and -[4, 4] range tests together.
* lib/asan-dg.exp (asan_symbolize): Prune BFD: prefixed error messages
from addr2line_output. Increment idx if asking for more than one address
in one object.
from addr2line_output. Increment idx if asking for more than one
address in one object.
2012-11-16 Jakub Jelinek <jakub@redhat.com>

View File

@ -0,0 +1,3 @@
// PR c++/55368
struct A { struct B *C,; }; // { dg-error "stray" }