Skip to content

Commit c0b21d1

Browse files
committed
c++: fix count of z candidates for non-viable candidates, nesting [PR121966]
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 <[email protected]>
1 parent 76fd69e commit c0b21d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gcc/cp/call.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4255,7 +4255,11 @@ print_z_candidates (location_t loc, struct z_candidate *candidates,
42554255

42564256
int num_candidates = 0;
42574257
for (auto iter = candidates; iter; iter = iter->next)
4258-
++num_candidates;
4258+
{
4259+
if (only_viable_p.is_true () && iter->viable != 1)
4260+
break;
4261+
++num_candidates;
4262+
}
42594263

42604264
inform_n (loc,
42614265
num_candidates, "there is %i candidate", "there are %i candidates",

0 commit comments

Comments
 (0)