https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122048
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:90ad957406104f9cc04365f6b071521a7c013dda commit r16-4113-g90ad957406104f9cc04365f6b071521a7c013dda Author: Jason Merrill <[email protected]> Date: Wed Sep 24 22:31:37 2025 +0100 c++: implicit 'this' in generic lambda [PR122048] Here template substitution was replacing a reference to the 'this' of X::f with the implicit closure parameter of the operator(), which is wrong. The closure parameter is never a suitable replacement for a 'this' parameter. PR c++/122048 gcc/cp/ChangeLog: * pt.cc (tsubst_expr): Don't use a lambda current_class_ptr. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/lambda-generic-this6.C: New test.
