lambdas require capturing ‘this’ to call static member function?

I agree, it should compile just fine. For the fix (if you didn’t know already), just add the reference capture and it will compile fine on gcc 4.6

struct B
{
    void g()
    {
        [&]() { B::f(); }();
    }

    static void f() { std::cout << "Hello World" << std::endl; };
};

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)