In GCC 4.5.0 the follwing class fails to compile. In C++0x draft n3126, the member variable 'f' does not require 'this->'. Surely the same should apply to a member function. struct S10 { int f; double p; void inc(int& a) { a += f;} void work(int n) { int m = n*n; int j = 40; f = 10; p =3.7; auto m3 = [this,&n]() mutable -> int { p++; f++; this->inc(n); //required return n; }; cout << "S9 m3():" << m3() << endl; cout << "f:" << f << " p:" << p << " n:" << n << endl; } };
The code fails to compile is "this->inc(n);" is replaced with "inc(n);"
dup *** This bug has been marked as a duplicate of bug 46047 ***