http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56135
Bug #: 56135 Summary: [c++11] this incorrectly captured as null in template member function Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: arnethed...@gmail.com Created attachment 29298 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29298 Test case showing broken capture of this When creating a lambda function in a template member function, when capturing this using [=], this is not captured correctly when the lambda only calls another template member function reusing the outer template argument. Qualifying the call with this or not passing on the outer template argument solves the issue. In the attached code, I expect this to be captured in all 4 cases, but the "broken" captures null resulting in the print out: ./test (nil) 0x7fff1354f2af 0x7fff1354f2af 0x7fff1354f2af GDB shows the same - this has been captured but with null as value. clang 3.2 captures this as expected.