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.
Showing
- gcc/cp/parser.cc 6 additions, 46 deletionsgcc/cp/parser.cc
- gcc/cp/pt.cc 1 addition, 26 deletionsgcc/cp/pt.cc
- gcc/cp/semantics.cc 8 additions, 4 deletionsgcc/cp/semantics.cc
- gcc/testsuite/g++.dg/cpp1y/lambda-generic-this5.C 22 additions, 0 deletionsgcc/testsuite/g++.dg/cpp1y/lambda-generic-this5.C
- gcc/testsuite/g++.dg/template/crash127.C 1 addition, 2 deletionsgcc/testsuite/g++.dg/template/crash127.C
Loading
Please register or sign in to comment