http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48523
Summary: [C++0x] lambda cannot capture 'this' in class template Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: r...@gcc.gnu.org CC: ja...@gcc.gnu.org template<typename> struct X { bool b; void f() { [this]{ return b; }; } }; X<int> x; l.cc: In lambda function: l.cc:8:20: error: invalid type argument (have ‘decltype (this)’) The same lambda works fine in a non-template class