diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-01-27 10:56:49 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-01-27 10:56:49 -0500 |
commit | dec8d0e5fa00ceb2ded78b8a3eba8976d860a90e (patch) | |
tree | 46e912a46c6c9af56ad5822f06098a7aca16a31b /gcc/tree.h | |
parent | ce6054a22ae14594a2919d2ad87cd9478e616fb3 (diff) | |
download | gcc-dec8d0e5fa00ceb2ded78b8a3eba8976d860a90e.zip gcc-dec8d0e5fa00ceb2ded78b8a3eba8976d860a90e.tar.gz gcc-dec8d0e5fa00ceb2ded78b8a3eba8976d860a90e.tar.bz2 |
c++: non-dependent immediate member fn call [PR99895]
Here we're emitting a bogus error during ahead of time evaluation of a
non-dependent immediate member function call such as a.f(args) because
the defacto templated form for such a call is (a.f)(args) but we're
trying to evaluate it using the intermediate CALL_EXPR built by
build_over_call, which has the non-member form f(a, args). The defacto
member form is built in build_new_method_call, so it seems we should
handle the immediate call there instead, or perhaps make build_over_call
build the correct form in the first place.
Giiven that there are many spots other than build_new_method_call that
call build_over_call for member functions, e.g. build_op_call, this
patch takes the latter approach.
In passing, this patch makes us avoid wrapping PARM_DECL in
NON_DEPENDENT_EXPR for benefit of the third testcase below.
PR c++/99895
gcc/cp/ChangeLog:
* call.cc (build_over_call): For a non-dependent member call,
build up a CALL_EXPR using a COMPONENT_REF callee, as in
build_new_method_call.
* pt.cc (build_non_dependent_expr): Don't wrap PARM_DECL either.
* tree.cc (build_min_non_dep_op_overload): Adjust accordingly
after the build_over_call change.
gcc/ChangeLog:
* tree.cc (build_call_vec): Add const to second parameter.
* tree.h (build_call_vec): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/consteval-memfn1.C: New test.
* g++.dg/cpp2a/consteval-memfn2.C: New test.
* g++.dg/cpp2a/consteval28.C: New test.
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -4589,7 +4589,7 @@ extern tree build_call_valist (tree, tree, int, va_list); #define build_call_array(T1,T2,N,T3)\ build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T3) extern tree build_call_array_loc (location_t, tree, tree, int, const tree *); -extern tree build_call_vec (tree, tree, vec<tree, va_gc> *); +extern tree build_call_vec (tree, tree, const vec<tree, va_gc> *); extern tree build_call_expr_loc_array (location_t, tree, int, tree *); extern tree build_call_expr_loc_vec (location_t, tree, vec<tree, va_gc> *); extern tree build_call_expr_loc (location_t, tree, int, ...); |