Commit 809fbdce by Jason Merrill Committed by Jason Merrill

re PR c++/50224 ([C++0x] bogus unused parameter warning (it is referenced in lambda))

	PR c++/50224
	* semantics.c (finish_id_expression): Mark captured variables used.

From-SVN: r178277
parent e7b6bcf3
2011-08-29 Jason Merrill <jason@redhat.com>
PR c++/50224
* semantics.c (finish_id_expression): Mark captured variables used.
2011-08-29 Jakub Jelinek <jakub@redhat.com> 2011-08-29 Jakub Jelinek <jakub@redhat.com>
Jason Merrill <jason@redhat.com> Jason Merrill <jason@redhat.com>
......
...@@ -2949,6 +2949,9 @@ finish_id_expression (tree id_expression, ...@@ -2949,6 +2949,9 @@ finish_id_expression (tree id_expression,
tree lambda_expr = NULL_TREE; tree lambda_expr = NULL_TREE;
tree initializer = convert_from_reference (decl); tree initializer = convert_from_reference (decl);
/* Mark it as used now even if the use is ill-formed. */
mark_used (decl);
/* Core issue 696: "[At the July 2009 meeting] the CWG expressed /* Core issue 696: "[At the July 2009 meeting] the CWG expressed
support for an approach in which a reference to a local support for an approach in which a reference to a local
[constant] automatic variable in a nested class or lambda body [constant] automatic variable in a nested class or lambda body
......
2011-08-29 Jason Merrill <jason@redhat.com>
PR c++/50224
* g++.dg/cpp0x/lambda/lambda-use2.C: New.
2011-08-29 Jakub Jelinek <jakub@redhat.com> 2011-08-29 Jakub Jelinek <jakub@redhat.com>
Jason Merrill <jason@redhat.com> Jason Merrill <jason@redhat.com>
......
// PR c++/50224
// { dg-options "-std=c++0x -Wunused-parameter" }
struct T;
void m(T& t) // ERROR here
{
[&]{
t; // ``t`` is referenced here
};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment