This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/42815] New: using variables only in C++0x lambda function closures produce unused var warnings
- From: "indy2718 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jan 2010 20:14:09 -0000
- Subject: [Bug c++/42815] New: using variables only in C++0x lambda function closures produce unused var warnings
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
// This compiled with
// g++ -Wall -Wextra -std=c++0x c.cpp
// c.cpp:5:6: warning: unused parameter ?x?
// c.cpp: In function ?void func2()?:
// c.cpp:15:6: warning: unused variable ?y?
#include <iostream>
void func1(int x)
{
auto f = [&](int j) { return j + x; };
std::cout << f(4) << std::endl;
}
void func2()
{
int y=100;
auto f = [&](int k) { return k+y; };
std::cout << f(6) << std::endl;
}
int main()
{
func1(8);
func2();
}
--
Summary: using variables only in C++0x lambda function closures
produce unused var warnings
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: indy2718 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42815