http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46047
Summary: Lambda expressions: access to member functions Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: mikhail_seme...@hotmail.com According to the latest C++0x draft (n3126), 'this' is not required in front of the member variable 'f' (there are a few examples on this issue in the draft). As far as I understand, the same should apply to a member function. In GCC 4.5.0, the use of inc(n) without the prefix "this->" causes an error. 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++; inc(n); //this-> required in 4.5.0 return n; }; cout << "S9 m3():" << m3() << endl; cout << "f:" << f << " p:" << p << " n:" << n << endl; } };