Bug 49482 - [4.6/4.7 regression][C++0x] unused parameter warning on lambda in function template
Summary: [4.6/4.7 regression][C++0x] unused parameter warning on lambda in function te...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.1
: P3 minor
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2011-06-21 07:30 UTC by Takaya Saito
Modified: 2011-06-21 20:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-06-21 19:59:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Takaya Saito 2011-06-21 07:30:58 UTC
testsuite (bug.cc):

template<class T>
void f() {
  []( bool b ){ return b; };
}

int main()
{
  f<int>();
}


message:

bug.cc: In static member function 'static bool f() [with T = int]::<lambda(bool)
>::_FUN(bool)':
bug.cc:3:4:   instantiated from 'f() [with T = int]::<lambda(bool)>'
bug.cc:3:3:   instantiated from 'void f() [with T = int]'
bug.cc:8:10:   instantiated from here
bug.cc:3:14: warning: parameter 'b' set but not used [-Wunused-but-set-parameter
]


version:

gcc-4.6.1-RC-20110620


note:

gcc-4.6-20110527 doesn't raise such a warning.
Comment 1 Jason Merrill 2011-06-21 19:59:52 UTC
This is a minor regression relative to 4.6.0 with a trivial fix I'm testing now.
Comment 2 Jason Merrill 2011-06-21 20:07:49 UTC
Author: jason
Date: Tue Jun 21 20:07:45 2011
New Revision: 175273

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175273
Log:
	PR c++/49482
	* semantics.c (maybe_add_lambda_conv_op): Call mark_exp_read for
	static fn parameters.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jason Merrill 2011-06-21 20:08:05 UTC
Author: jason
Date: Tue Jun 21 20:08:01 2011
New Revision: 175274

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175274
Log:
	PR c++/49482
	* semantics.c (maybe_add_lambda_conv_op): Call mark_exp_read for
	static fn parameters.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-warn3.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/semantics.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 4 Jason Merrill 2011-06-21 20:08:57 UTC
Fixed for 4.6.1.