re PR c++/44991 (default argument with '<' cause compilation error)

PR c++/44991
	* parser.c (cp_parser_parameter_declaration): Pop parameter decls
	after tentative parsing.

From-SVN: r163629
This commit is contained in:
Jason Merrill 2010-08-29 15:24:37 -04:00 committed by Jason Merrill
parent 1f5ca1a15c
commit 98d4336049
4 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2010-08-29 Jason Merrill <jason@redhat.com>
PR c++/44991
* parser.c (cp_parser_parameter_declaration): Pop parameter decls
after tentative parsing.
2010-08-22 Joseph Myers <joseph@codesourcery.com>
* Make-lang.in (g++spec.o): Update dependencies.

View File

@ -15564,6 +15564,7 @@ cp_parser_parameter_declaration (cp_parser *parser,
the default argument; otherwise the default
argument continues. */
bool error = false;
tree t;
/* Set ITALP so cp_parser_parameter_declaration_list
doesn't decide to commit to this parse. */
@ -15572,7 +15573,11 @@ cp_parser_parameter_declaration (cp_parser *parser,
cp_parser_parse_tentatively (parser);
cp_lexer_consume_token (parser->lexer);
begin_scope (sk_function_parms, NULL_TREE);
cp_parser_parameter_declaration_list (parser, &error);
for (t = current_binding_level->names; t; t = DECL_CHAIN (t))
pop_binding (DECL_NAME (t), t);
leave_scope ();
if (!cp_parser_error_occurred (parser) && !error)
done = true;
cp_parser_abort_tentative_parse (parser);

View File

@ -1,3 +1,8 @@
2010-08-29 Jason Merrill <jason@redhat.com>
PR c++/44991
* g++.dg/parse/defarg15.C: New.
2010-08-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/45439

View File

@ -0,0 +1,5 @@
// PR c++/44991
class bar {
void foo(bool a = 3 < 2, bool b = true) {}
};