]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: xobj lambda 'this' capture [PR113563]
authorJason Merrill <jason@redhat.com>
Thu, 29 May 2025 16:36:23 +0000 (12:36 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 29 May 2025 20:21:17 +0000 (16:21 -0400)
commit2047aa4ce2ed9976fb36e984b43864fcd6f3a65d
tree9ea2eff196aab9be76952905a70a3ba094d629fd
parent977fadd69776e2a8a6daca43e1c898bc4f87154d
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.
gcc/cp/lambda.cc
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda16.C [new file with mode: 0644]