re PR c++/46159 (Bogus warning about lambdas)

PR c++/46159
	* parser.c (cp_parser_primary_expression): Don't warn about a
	failed tentative parse.

From-SVN: r170621
This commit is contained in:
Jason Merrill 2011-03-02 13:18:41 -05:00 committed by Jason Merrill
parent c6f54c7aa7
commit f8221c67ba
4 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2011-03-01 Jason Merrill <jason@redhat.com>
PR c++/46159
* parser.c (cp_parser_primary_expression): Don't warn about a
failed tentative parse.
PR c++/47200
* semantics.c (cxx_bind_parameters_in_call): Don't call
adjust_temp_type on non-constant args.

View File

@ -3712,8 +3712,14 @@ cp_parser_primary_expression (cp_parser *parser,
if (c_dialect_objc ())
/* We have an Objective-C++ message. */
return cp_parser_objc_expression (parser);
maybe_warn_cpp0x (CPP0X_LAMBDA_EXPR);
return cp_parser_lambda_expression (parser);
{
tree lam = cp_parser_lambda_expression (parser);
/* Don't warn about a failed tentative parse. */
if (cp_parser_error_occurred (parser))
return error_mark_node;
maybe_warn_cpp0x (CPP0X_LAMBDA_EXPR);
return lam;
}
case CPP_OBJC_STRING:
if (c_dialect_objc ())

View File

@ -1,5 +1,7 @@
2011-03-01 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/lambda/lambda-98.C: New.
* g++.dg/cpp0x/constexpr-non-const-arg2.C: New.
2011-03-02 Richard Sandiford <richard.sandiford@linaro.org>

View File

@ -0,0 +1,8 @@
// PR c++/46159
// { dg-options -std=c++98 }
void
f()
{
int **p = new(int(*[2]));
}