aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-05-14 12:56:18 -0400
committerPatrick Palka <ppalka@redhat.com>2020-05-14 12:56:18 -0400
commit098cf31aa2631db6922d4de5661c1b0ce19af0aa (patch)
treed8bc0802826202050d19c96ff6bea6cdeb11a1bf /gcc/cp/class.c
parentd975519ad1066ed0397714c91aafadadb52a63dd (diff)
downloadgcc-098cf31aa2631db6922d4de5661c1b0ce19af0aa.zip
gcc-098cf31aa2631db6922d4de5661c1b0ce19af0aa.tar.gz
gcc-098cf31aa2631db6922d4de5661c1b0ce19af0aa.tar.bz2
c++: Missing SFINAE with lookup_fnfields [PR78446]
Here we're failing to do SFINAE in build_op_call when looking up the class's operator() via lookup_fnfields, which calls lookup_member always with complain=tf_warning_or_error; from there we would complain about an ambiguous lookup for operator(). This patch fixes this by adding a tsubst_flags_t parameter to lookup_fnfields and adjusting all its callers appropriately. gcc/cp/ChangeLog: PR c++/78446 * call.c (build_op_call): Pass complain to lookup_fnfields. (build_special_member_call): Likewise. * class.c (type_requires_array_cookie): Pass tf_warning_or_error to lookup_fnfields. * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter. * except.c (build_throw): Pass tf_warning_or_error to lookup_fnfields. * init.c (build_new_1): Pass complain to lookup_fnfields. * method.c (locate_fn_flags): Likewise. * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error to lookup_fnfields. * pt.c (tsubst_baselink): Pass complain to lookup_fnfields. * search.c (lookup_fnfields): New 'complain' parameter. Pass it to lookup_member. gcc/testsuite/ChangeLog: PR c++/78446 * g++.dg/template/sfinae31.C: New test.
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 15f490d..bab15524 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5644,7 +5644,7 @@ type_requires_array_cookie (tree type)
a cookie. */
fns = lookup_fnfields (TYPE_BINFO (type),
ovl_op_identifier (false, VEC_DELETE_EXPR),
- /*protect=*/0);
+ /*protect=*/0, tf_warning_or_error);
/* If there are no `operator []' members, or the lookup is
ambiguous, then we don't need a cookie. */
if (!fns || fns == error_mark_node)