From: reichelt Date: Mon, 17 Oct 2005 22:22:30 +0000 (+0000) Subject: PR c++/23440 X-Git-Tag: upstream/4.9.2~58138 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f959b7da319ae9245a76feb9749b7a6e222bb14;p=platform%2Fupstream%2Flinaro-gcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105520 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 08344ee..6223540 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-10-17 Volker Reichelt + + PR c++/23440 + * parser.c (cp_parser_statement): If the parser reached CPP_EOF, + only complain about missing statement. + 2005-10-17 Nathan Sidwell PR c++/24386 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 45fc69f..300c266 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5e1d0af..0815420 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-17 Volker Reichelt + + PR c++/23440 + * g++.dg/parse/for1.C: New test. + 2005-10-17 Paul Thomas PR fortran/23446 diff --git a/gcc/testsuite/g++.dg/parse/for1.C b/gcc/testsuite/g++.dg/parse/for1.C new file mode 100644 index 0000000..1e310ee --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/for1.C @@ -0,0 +1,7 @@ +// PR c++/23440 +// Origin: Volker Reichelt +// { dg-do compile } +// { dg-options "" } + +# 0 "for1.C" +void foo() { for (;;) // { dg-error "at end of input" "" { target *-*-* } 0 }