This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52281] New: No warnings generated for unused captures
- From: "bootsarehax at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Feb 2012 15:14:26 +0000
- Subject: [Bug c++/52281] New: No warnings generated for unused captures
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52281
Bug #: 52281
Summary: No warnings generated for unused captures
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bootsarehax@gmail.com
I would expect the code:
int main()
{
int i = 23;
auto x = [&i]() {return 25;};
x();
return 0;
}
to issue a warning when compiled with -Wall -Wextra similar to unused
variables.
This seems similar to this:
struct foo {
int operator()() { return 42;}
int x;
};
gcc does not issue a warning here as well, although it might be useful.