diff options
author | Jason Merrill <jason@redhat.com> | 2011-06-21 16:07:45 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-06-21 16:07:45 -0400 |
commit | 358bb337a5b54b0e6f9f263342437e9633d869bb (patch) | |
tree | 4513c280fa8eea9464ad7cbe3339631b7830ea1a | |
parent | ccaff498ac86149a980278f7e527270a1b3d7089 (diff) | |
download | gcc-358bb337a5b54b0e6f9f263342437e9633d869bb.zip gcc-358bb337a5b54b0e6f9f263342437e9633d869bb.tar.gz gcc-358bb337a5b54b0e6f9f263342437e9633d869bb.tar.bz2 |
re PR c++/49482 ([C++0x] unused parameter warning on lambda in function template)
PR c++/49482
* semantics.c (maybe_add_lambda_conv_op): Call mark_exp_read for
static fn parameters.
From-SVN: r175273
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C | 12 |
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4fc8017..cf325fc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-06-21 Jason Merrill <jason@redhat.com> + PR c++/49482 + * semantics.c (maybe_add_lambda_conv_op): Call mark_exp_read for + static fn parameters. + * call.c (add_builtin_candidates): Use cv_unqualified rather than TYPE_MAIN_VARIANT. * pt.c (tsubst_arg_types): Likewise. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 594d239..6622de6 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8780,7 +8780,10 @@ maybe_add_lambda_conv_op (tree type) argvec = make_tree_vector (); VEC_quick_push (tree, argvec, arg); for (arg = DECL_ARGUMENTS (statfn); arg; arg = DECL_CHAIN (arg)) - VEC_safe_push (tree, gc, argvec, arg); + { + mark_exp_read (arg); + VEC_safe_push (tree, gc, argvec, arg); + } call = build_call_a (callop, VEC_length (tree, argvec), VEC_address (tree, argvec)); CALL_FROM_THUNK_P (call) = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b204070..59464fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-06-21 Jason Merrill <jason@redhat.com> + PR c++/49482 + * g++.dg/cpp0x/lambda/lambda-warn3.C: New. + PR c++/49418 * g++.dg/template/param3.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C new file mode 100644 index 0000000..77f35bc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C @@ -0,0 +1,12 @@ +// PR c++/49482 +// { dg-options "-std=c++0x -Wunused-but-set-parameter" } + +template<class T> +void f() { + []( bool b ){ return b; }; +} + +int main() +{ + f<int>(); +} |