https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121008
--- Comment #3 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:131ba6137bca263d7381ad3331840ee05e306fc9 commit r16-2147-g131ba6137bca263d7381ad3331840ee05e306fc9 Author: Jason Merrill <ja...@redhat.com> Date: Wed Jul 9 10:38:20 2025 -0400 c++: 'this' in lambda in noexcept-spec [PR121008] In r16-970 I changed finish_this_expr to look at current_class_type rather than current_class_ptr to accommodate explicit object lambdas. But here in a lambda in the noexcept-spec, the closure type doesn't yet have the function as its context, so lambda_expr_this_capture can't find the function and gives up. But in this context current_class_ptr refers to the function's 'this', so let's go back to using it in that case. PR c++/121008 PR c++/113563 gcc/cp/ChangeLog: * semantics.cc (finish_this_expr): Do check current_class_ref for non-lambda. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/lambda-uneval28.C: New test.