re PR c++/13269 (compiler hangs on invalid code)

PR c++/13269
	* parser.c (cp_parser_function_definition_after_declarator): Stop
	scanning tokens when reaching EOF.

	PR c++/13269
	* g++.dg/parse/error5.C: New test.

From-SVN: r74661
This commit is contained in:
Mark Mitchell 2003-12-16 01:49:41 +00:00 committed by Mark Mitchell
parent ea0e2a51f4
commit 21eb631b82
4 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2003-12-15 Mark Mitchell <mark@codesourcery.com>
PR c++/13269
* parser.c (cp_parser_function_definition_after_declarator): Stop
scanning tokens when reaching EOF.
PR c++/12989
* typeck.c (cxx_sizeof_or_alignof_expr): Robustify.

View File

@ -13807,7 +13807,8 @@ cp_parser_function_definition_after_declarator (cp_parser* parser,
/* Issue an error message. */
error ("named return values are no longer supported");
/* Skip tokens until we reach the start of the function body. */
while (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE))
while (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)
&& cp_lexer_next_token_is_not (parser->lexer, CPP_EOF))
cp_lexer_consume_token (parser->lexer);
}
/* The `extern' in `extern "C" void f () { ... }' does not apply to

View File

@ -1,5 +1,8 @@
2003-12-15 Mark Mitchell <mark@codesourcery.com>
PR c++/13269
* g++.dg/parse/error5.C: New test.
PR c++/12989
* g++.dg/expr/sizeof1.C: New test.

View File

@ -0,0 +1,4 @@
// PR c++/13269
class Foo { int foo() return 0; } }; // { dg-error "" }