In
r15-6116-gd3dd24acd74605 I updated print_z_candidates to show the
number of candidates, and a number for each candidate.
PR c++/121966 notes that the printed count is sometimes higher than
what's actually printed: I missed the case where candidates in the
list aren't printed due to not being viable.
Fixed thusly.
gcc/cp/ChangeLog:
PR c++/121966
* call.cc (print_z_candidates): Copy the filtering logic on viable
candidates from the printing loop to the counting loop, so that
num_candidates matches the number of iterations of the latter
loop.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
int num_candidates = 0;
for (auto iter = candidates; iter; iter = iter->next)
- ++num_candidates;
+ {
+ if (only_viable_p.is_true () && iter->viable != 1)
+ break;
+ ++num_candidates;
+ }
inform_n (loc,
num_candidates, "there is %i candidate", "there are %i candidates",