http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50748

             Bug #: 50748
           Summary: Incorrect error message for lambda inside static
                    member function
    Classification: Unclassified
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ve...@mail.ru


struct B
{
    int member;
    static void fn()
    {
        member = 0; //  error: invalid use of member 'B::member' 
                    //  in static member function
        auto lambda = [&]()
        {
            member = 0;  // error: 'this' was not captured 
                         // for this lambda function
        };
    }
};

Second error message is incorrect and confusing because there is no 'this' in
static function member. Error message might be the same.

Reply via email to