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++/50748] New: Incorrect error message for lambda inside static member function


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: unassigned@gcc.gnu.org
        ReportedBy: velok@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.


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