diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 657eca93d23a2505f8c39fe519788c38317fd2f5..a49fde949d5d6cb74257da53cad251034f0489fe 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -13227,10 +13227,11 @@ tourney (struct z_candidate *candidates, tsubst_flags_t complain) been compared to. */ for (challenger = candidates; - challenger != champ - && challenger != champ_compared_to_predecessor; + challenger != champ; challenger = challenger->next) { + if (challenger == champ_compared_to_predecessor) + continue; fate = joust (champ, challenger, 0, complain); if (fate != 1) return NULL; diff --git a/gcc/testsuite/g++.dg/warn/Wsign-promo1.C b/gcc/testsuite/g++.dg/warn/Wsign-promo1.C new file mode 100644 index 0000000000000000000000000000000000000000..51b76eee735f90fb3a5ceb16f0f02d7f87da8483 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsign-promo1.C @@ -0,0 +1,15 @@ +// Check that we get joust warnings from comparing the final champ to a +// candidate between it and the previous champ. + +// { dg-additional-options -Wsign-promo } + +struct A { A(int); }; + +enum E { e }; + +int f(int, A); +int f(unsigned, A); +int f(int, int); + +int i = f(e, 42); // { dg-warning "passing 'E'" } +// { dg-warning "in call to 'int f" "" { target *-*-* } .-1 }