Commit 0ef8776d by Volker Reichelt Committed by Volker Reichelt

re PR c++/23440 ("void f(){for" crashes the C++ frontend)

	PR c++/23440
	* parser.c (cp_parser_statement): If the parser reached CPP_EOF,
	only complain about missing statement.

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

From-SVN: r105520
parent 4213f93b
2005-10-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/23440
* parser.c (cp_parser_statement): If the parser reached CPP_EOF,
only complain about missing statement.
2005-10-17 Nathan Sidwell <nathan@codesourcery.com>
PR c++/24386
......
......@@ -6087,6 +6087,11 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr)
cp_lexer_handle_pragma (parser->lexer);
return;
}
else if (token->type == CPP_EOF)
{
cp_parser_error (parser, "expected statement");
return;
}
/* Everything else must be a declaration-statement or an
expression-statement. Try for the declaration-statement
......
2005-10-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/23440
* g++.dg/parse/for1.C: New test.
2005-10-17 Paul Thomas <pault@gcc.gnu.org>
PR fortran/23446
// PR c++/23440
// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
// { dg-do compile }
// { dg-options "" }
# 0 "for1.C"
void foo() { for (;;) // { dg-error "at end of input" "" { target *-*-* } 0 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment