Skip to content
Snippets Groups Projects
Commit a9a740ba authored by Jason Merrill's avatar Jason Merrill Committed by Jason Merrill
Browse files

re PR c++/43886 ([C++0x] name lookup failure on un-used local variable in...

re PR c++/43886 ([C++0x] name lookup failure on un-used local variable in lambda compound-statement)

	PR c++/43886
	* parser.c (cp_parser_lambda_body): Clear local_variables_forbidden_p.

From-SVN: r177216
parent 54e7d7f5
No related branches found
No related tags found
No related merge requests found
2011-08-02 Jason Merrill <jason@redhat.com> 2011-08-02 Jason Merrill <jason@redhat.com>
PR c++/43886
* parser.c (cp_parser_lambda_body): Clear local_variables_forbidden_p.
PR c++/49577 PR c++/49577
* typeck2.c (check_narrowing): Check unsigned mismatch. * typeck2.c (check_narrowing): Check unsigned mismatch.
* semantics.c (finish_compound_literal): check_narrowing. * semantics.c (finish_compound_literal): check_narrowing.
......
...@@ -7801,12 +7801,15 @@ static void ...@@ -7801,12 +7801,15 @@ static void
cp_parser_lambda_body (cp_parser* parser, tree lambda_expr) cp_parser_lambda_body (cp_parser* parser, tree lambda_expr)
{ {
bool nested = (current_function_decl != NULL_TREE); bool nested = (current_function_decl != NULL_TREE);
bool local_variables_forbidden_p = parser->local_variables_forbidden_p;
if (nested) if (nested)
push_function_context (); push_function_context ();
else else
/* Still increment function_depth so that we don't GC in the /* Still increment function_depth so that we don't GC in the
middle of an expression. */ middle of an expression. */
++function_depth; ++function_depth;
/* Clear this in case we're in the middle of a default argument. */
parser->local_variables_forbidden_p = false;
   
/* Finish the function call operator /* Finish the function call operator
- class_specifier - class_specifier
...@@ -7904,6 +7907,7 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr) ...@@ -7904,6 +7907,7 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr)
expand_or_defer_fn (finish_function (/*inline*/2)); expand_or_defer_fn (finish_function (/*inline*/2));
} }
   
parser->local_variables_forbidden_p = local_variables_forbidden_p;
if (nested) if (nested)
pop_function_context(); pop_function_context();
else else
......
2011-08-02 Jason Merrill <jason@redhat.com> 2011-08-02 Jason Merrill <jason@redhat.com>
PR c++/43886
* g++.dg/cpp0x/lambda/lambda-defarg2.C: New.
PR c++/49577 PR c++/49577
* g++.dg/cpp0x/initlist5.C: Add additional cases. * g++.dg/cpp0x/initlist5.C: Add additional cases.
......
// PR c++/43886
// { dg-options -std=c++0x }
void f2() {
int i = 1;
void g5(int = ([]{ return sizeof i; })());
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment