diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 23b61d0e491d8ed017e7b7372c9eb155f4c494fa..02dbdcda1d2d606ee5369e514a5d9524ca0e4fa7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 1998-05-25 Mark Mitchell <mark@markmitchell.com> + * call.c (tourney): Don't do any extra comparisons. + * decl2.c (build_anon_union_vars): Don't crash on empty sub-unions. * cp-tree.h (processing_template_parmlist): Declare. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 01bb53fe089eab1671f44b33545d3cbdacd22c42..fb280ebf2bf73017f7838bfb3af4729ce2bccf7c 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4389,6 +4389,7 @@ tourney (candidates) { struct z_candidate *champ = candidates, *challenger; int fate; + int champ_compared_to_predecessor = 0; /* Walk through the list once, comparing each current champ to the next candidate, knocking out a candidate or two with each comparison. */ @@ -4405,19 +4406,24 @@ tourney (candidates) champ = challenger->next; if (champ == 0) return 0; + champ_compared_to_predecessor = 0; } else - champ = challenger; + { + champ = challenger; + champ_compared_to_predecessor = 1; + } challenger = champ->next; } } /* Make sure the champ is better than all the candidates it hasn't yet - been compared to. This may do one more comparison than necessary. Oh - well. */ + been compared to. */ - for (challenger = candidates; challenger != champ; + for (challenger = candidates; + challenger != champ + && !(champ_compared_to_predecessor && challenger->next == champ); challenger = challenger->next) { fate = joust (champ, challenger, 0);