This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/42815] New: using variables only in C++0x lambda function closures produce unused var warnings


// 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]