https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113810
Bug ID: 113810 Summary: A lambda with this auto style that captures this in a member function cannot use this pointer Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- struct S { int i = 42; constexpr auto f() { return [this](this auto) { return this->i; }(); }; }; int main() { return S().f(); } https://godbolt.org/z/rMqaT9r9E GCC rejects the above with: <source>:5:14: error: invalid use of 'this' in non-member function 5 | return this->i; | ^~~~ But lambda captures this pointer so it should be usable.