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
This commit is contained in:
parent
e7b6bcf357
commit
809fbdce1c
@ -1,3 +1,8 @@
|
||||
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>
|
||||
Jason Merrill <jason@redhat.com>
|
||||
|
||||
|
@ -2949,6 +2949,9 @@ finish_id_expression (tree id_expression,
|
||||
tree lambda_expr = NULL_TREE;
|
||||
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
|
||||
support for an approach in which a reference to a local
|
||||
[constant] automatic variable in a nested class or lambda body
|
||||
|
@ -1,3 +1,8 @@
|
||||
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>
|
||||
Jason Merrill <jason@redhat.com>
|
||||
|
||||
|
11
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C
Normal file
11
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-use2.C
Normal file
@ -0,0 +1,11 @@
|
||||
// PR c++/50224
|
||||
// { dg-options "-std=c++0x -Wunused-parameter" }
|
||||
|
||||
struct T;
|
||||
|
||||
void m(T& t) // ERROR here
|
||||
{
|
||||
[&]{
|
||||
t; // ``t`` is referenced here
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user