https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113563
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:2047aa4ce2ed9976fb36e984b43864fcd6f3a65d commit r16-970-g2047aa4ce2ed9976fb36e984b43864fcd6f3a65d Author: Jason Merrill <ja...@redhat.com> Date: Thu May 29 12:36:23 2025 -0400 c++: xobj lambda 'this' capture [PR113563] Various places were still making assumptions that we could get to the 'this' capture through current_class_ref in a lambda op(), which is incorrect for an explicit object op(). PR c++/113563 gcc/cp/ChangeLog: * lambda.cc (build_capture_proxy): Check pointerness of the member, not the proxy type. (lambda_expr_this_capture): Don't assume current_class_ref. (nonlambda_method_basetype): Likewise. * semantics.cc (finish_non_static_data_member): Don't assume TREE_TYPE (object) is set. (finish_this_expr): Check current_class_type for lambda, not current_class_ref. gcc/testsuite/ChangeLog: * g++.dg/cpp23/explicit-obj-lambda16.C: New test.