Passing a `this`-capturing generic lambda (to a template function) that calls a member function of `this` without an explicit `this->` results in an error: error: cannot call member function 'void Example::foo(int)' without object call([this](auto x){ foo(x); });` If the lambda is not generic, or if the lambda is not passed to any other function but called in place, it compiles without an explicit `this->`. For reference, clang 3.6+ is cool with the code in all situations. --- Minimal example: http://melpon.org/wandbox/permlink/M2eH3FUOentPfieM template<typename TF> void call(TF&& f) { f(1); } struct Example { void foo(int){ } void bar() { call([this](auto x){ foo(x); }); } }; int main() { Example{}.bar(); return 0; } --- StackOverflow question with more examples: http://stackoverflow.com/questions/32097759
More test cases, using minor variations to the code posted above: With bar() = call([this](auto x){ foo(x); }); clang++ 3.6+ compiles. g++ 5.2+ does not compile. With bar() = call([this](auto x){ this->foo(x); }); clang++ 3.6+ compiles. g++ 5.2+ compiles. With bar() = call([this](int x){ foo(x); }); clang++ 3.6+ compiles. g++ 5.2+ compiles. With bar() = [this](auto x){ foo(x); }(1); clang++ 3.6+ compiles. g++ 5.2+ compiles.
Fixed in 7.1.0, we already have testcases.