diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-12-13 16:46:01 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-12-13 16:46:01 -0500 |
commit | b24c09bfb626271cda345f5a6f0d3a6b6480593d (patch) | |
tree | 5ba81aabbeef93b70b1f524aaed14c90efb26fc2 /configure.ac | |
parent | ead2b94d602ce758575aa46ec35a51c3157ff9cd (diff) | |
download | gcc-b24c09bfb626271cda345f5a6f0d3a6b6480593d.zip gcc-b24c09bfb626271cda345f5a6f0d3a6b6480593d.tar.gz gcc-b24c09bfb626271cda345f5a6f0d3a6b6480593d.tar.bz2 |
c++: remember candidates that we ignored
During overload resolution, we sometimes outright ignore a function in
the overload set and leave no trace of it in the candidates list, for
example when we find a perfect non-template candidate we discard all
function templates, or when the callee is a template-id we discard all
non-template functions. We should still however make note of these
non-viable functions when diagnosing overload resolution failure, but
that's not possible if they're not present in the returned candidates
list.
To that end, this patch reworks add_candidates to add such ignored
functions to the list. The new rr_ignored rejection reason is somewhat
of a catch-all; we could perhaps split it up into more specific rejection
reasons, but I leave that as future work.
gcc/cp/ChangeLog:
* call.cc (enum rejection_reason_code): Add rr_ignored.
(add_ignored_candidate): Define.
(ignored_candidate_p): Define.
(add_template_candidate_real): Do add_ignored_candidate
instead of returning NULL.
(splice_viable): Put ignored (non-viable) candidates last.
(print_z_candidate): Handle ignored candidates.
(build_new_function_call): Refine shortcut that calls
cp_build_function_call_vec now that non-templates can
appear in the candidate list for a template-id call.
(add_candidates): Replace 'bad_fns' overload with 'bad_cands'
candidate list. When not considering a candidate, add it
to the list as an ignored candidate. Add all 'bad_cands'
to the overload set as well.
gcc/testsuite/ChangeLog:
* g++.dg/diagnostic/param-type-mismatch-2.C: Rename template
function test_7 that (maybe accidentally) shares the same name
as its non-template callee.
* g++.dg/overload/error6.C: New test.
Diffstat (limited to 'configure.ac')
0 files changed, 0 insertions, 0 deletions