Commit 1f4a7a48 by Jason Merrill Committed by Jason Merrill

re PR c++/41920 ([C++0x] Invalid 'unused parameter' warning for parameters used in lambdas)

	PR c++/41920
	* semantics.c (build_lambda_object): Call mark_used on captured
	variables.

From-SVN: r156085
parent e4672ccd
2010-01-20 Jason Merrill <jason@redhat.com> 2010-01-20 Jason Merrill <jason@redhat.com>
PR c++/41920
* semantics.c (build_lambda_object): Call mark_used on captured
variables.
PR c++/40750 PR c++/40750
* decl.c (grokdeclarator): Clear type_quals for a member function * decl.c (grokdeclarator): Clear type_quals for a member function
declared using a typedef. Don't complain about adding cv-quals declared using a typedef. Don't complain about adding cv-quals
......
...@@ -5408,6 +5408,9 @@ build_lambda_object (tree lambda_expr) ...@@ -5408,6 +5408,9 @@ build_lambda_object (tree lambda_expr)
tree field = TREE_PURPOSE (node); tree field = TREE_PURPOSE (node);
tree val = TREE_VALUE (node); tree val = TREE_VALUE (node);
if (DECL_P (val))
mark_used (val);
/* Mere mortals can't copy arrays with aggregate initialization, so /* Mere mortals can't copy arrays with aggregate initialization, so
do some magic to make it work here. */ do some magic to make it work here. */
if (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE) if (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE)
......
2010-01-20 Jason Merrill <jason@redhat.com> 2010-01-20 Jason Merrill <jason@redhat.com>
PR c++/41920
* g++.dg/cpp0x/lambda/lambda-warn1.C: New.
PR c++/40750 PR c++/40750
* g++.dg/parse/fn-typedef1.C: New. * g++.dg/parse/fn-typedef1.C: New.
* g++.dg/other/cv_quals.C: Adjust. * g++.dg/other/cv_quals.C: Adjust.
......
// PR c++/41920
// { dg-options "-std=c++0x -Wall -Wextra" }
int foo(int i)
{
auto bar = [=](){ return i; };
return bar();
}
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