diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-10-20 10:50:19 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-10-20 10:50:19 -0400 |
commit | 909672f02ff75a6a94c88dee4aa41e92edb1d1ed (patch) | |
tree | 5d586e5a4604b078e2f8630ef3729ba1bdff3513 /gcc/rust/backend | |
parent | cd0e05b7ac3dee11287078acd00a19e52a738963 (diff) | |
download | gcc-909672f02ff75a6a94c88dee4aa41e92edb1d1ed.zip gcc-909672f02ff75a6a94c88dee4aa41e92edb1d1ed.tar.gz gcc-909672f02ff75a6a94c88dee4aa41e92edb1d1ed.tar.bz2 |
c++: non-static memfn call dependence cleanup [PR106086]
In cp_parser_postfix_expression, and in the CALL_EXPR case of
tsubst_copy_and_build, we essentially repeat the type-dependent and
COMPONENT_REF callee cases of finish_call_expr. This patch deduplicates
this logic by making both spots consistently go through finish_call_expr.
This allows us to easily fix PR106086 -- which is about us neglecting to
capture 'this' when we resolve a use of a non-static member function of
the current instantiation only at lambda regeneration time -- by moving
the call to maybe_generic_this_capture from the parser to finish_call_expr
so that we consider capturing 'this' at regeneration time as well.
PR c++/106086
gcc/cp/ChangeLog:
* parser.cc (cp_parser_postfix_expression): Consolidate three
calls to finish_call_expr, one to build_new_method_call and
one to build_min_nt_call_vec into one call to finish_call_expr.
Don't call maybe_generic_this_capture here.
* pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Remove
COMPONENT_REF callee handling.
(type_dependent_expression_p): Use t_d_object_e_p instead of
t_d_e_p for COMPONENT_REF and OFFSET_REF.
* semantics.cc (finish_call_expr): In the type-dependent case,
call maybe_generic_this_capture here instead.
gcc/testsuite/ChangeLog:
* g++.dg/template/crash127.C: Expect additional error due to
being able to check the member access expression ahead of time.
Strengthen the test by not instantiating the class template.
* g++.dg/cpp1y/lambda-generic-this5.C: New test.
Diffstat (limited to 'gcc/rust/backend')
0 files changed, 0 insertions, 0 deletions