re PR c++/38635 (ICE parsing broken code)

PR c++/38635
	* parser.c (cp_parser_condition): Use cp_parser_require
	instead of cp_lexer_consume_token to consume =.

	* g++.dg/parse/cond4.C: New test.

From-SVN: r142951
This commit is contained in:
Jakub Jelinek 2008-12-29 19:27:03 +01:00 committed by Jakub Jelinek
parent 04be6ff5a8
commit 049dba029b
4 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2008-12-29 Jakub Jelinek <jakub@redhat.com>
PR c++/38635
* parser.c (cp_parser_condition): Use cp_parser_require
instead of cp_lexer_consume_token to consume =.
PR c++/38637
* decl.c (start_enum): If enumtype is error_mark_node, exit early.

View File

@ -7398,7 +7398,7 @@ cp_parser_condition (cp_parser* parser)
else
{
/* Consume the `='. */
cp_lexer_consume_token (parser->lexer);
cp_parser_require (parser, CPP_EQ, "%<=%>");
initializer = cp_parser_initializer_clause (parser, &non_constant_p);
}
if (BRACE_ENCLOSED_INITIALIZER_P (initializer))

View File

@ -1,5 +1,8 @@
2008-12-29 Jakub Jelinek <jakub@redhat.com>
PR c++/38635
* g++.dg/parse/cond4.C: New test.
PR c++/36191
* g++.dg/torture/pr36191.C: New test.

View File

@ -0,0 +1,6 @@
// PR c++/38635
// { dg-do compile }
void foo()
{
if (struct A{}// { dg-error "types may not be defined|expected" }