This patch is a followup to: "c++: use diagnostic nesting [PR116253]"
Following Sy Brand's UX suggestions in P2429R0 for example 1, this patch tweaks print_z_candidates to add a note about the number of candidates, and adds a candidate number to each one. Various examples of output can be seen in the testsuite part of the patch. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. OK for trunk? gcc/cp/ChangeLog: * call.cc (print_z_candidates): Count the number of candidates and issue a note stating the count at an intermediate nesting level. Number the individual candidates. gcc/testsuite/ChangeLog: * g++.dg/concepts/diagnostic9.C: Update expected results for candidate count and numbering. * g++.dg/concepts/nested-diagnostics-1-truncated.C: * g++.dg/concepts/nested-diagnostics-1.C: Likewise. * g++.dg/concepts/nested-diagnostics-2.C: Likewise. * g++.dg/cpp23/explicit-obj-lambda11.C: Likewise. * g++.dg/cpp2a/desig4.C: Likewise. * g++.dg/cpp2a/desig6.C: Likewise. * g++.dg/cpp2a/spaceship-eq15.C: Likewise. * g++.dg/diagnostic/function-color1.C: Likewise. * g++.dg/diagnostic/param-type-mismatch-2.C: Likewise. * g++.dg/diagnostic/pr100716-1.C: Likewise. * g++.dg/diagnostic/pr100716.C: Likewise. * g++.dg/lookup/operator-2.C: Likewise. * g++.dg/lookup/pr80891-5.C: Likewise. * g++.dg/modules/adhoc-1_b.C: Likewise. * g++.dg/modules/err-1_c.C: Likewise. * g++.dg/modules/err-1_d.C: Likewise. * g++.dg/other/return2.C: Likewise. * g++.dg/overload/error6.C: Likewise. * g++.dg/template/local6.C: Likewise. Signed-off-by: David Malcolm <dmalc...@redhat.com> --- gcc/cp/call.cc | 16 ++++++- gcc/testsuite/g++.dg/concepts/diagnostic9.C | 2 +- .../concepts/nested-diagnostics-1-truncated.C | 25 +++++------ .../g++.dg/concepts/nested-diagnostics-1.C | 43 ++++++++++--------- .../g++.dg/concepts/nested-diagnostics-2.C | 27 ++++++------ .../g++.dg/cpp23/explicit-obj-lambda11.C | 3 +- gcc/testsuite/g++.dg/cpp2a/desig4.C | 4 +- gcc/testsuite/g++.dg/cpp2a/desig6.C | 4 +- gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C | 8 ++-- .../g++.dg/diagnostic/function-color1.C | 2 +- .../g++.dg/diagnostic/param-type-mismatch-2.C | 10 ++++- gcc/testsuite/g++.dg/diagnostic/pr100716-1.C | 14 +++--- gcc/testsuite/g++.dg/diagnostic/pr100716.C | 14 +++--- gcc/testsuite/g++.dg/lookup/operator-2.C | 2 +- gcc/testsuite/g++.dg/lookup/pr80891-5.C | 6 +-- gcc/testsuite/g++.dg/modules/adhoc-1_b.C | 4 +- gcc/testsuite/g++.dg/modules/err-1_c.C | 10 ++--- gcc/testsuite/g++.dg/modules/err-1_d.C | 6 +-- gcc/testsuite/g++.dg/other/return2.C | 2 +- gcc/testsuite/g++.dg/overload/error6.C | 4 +- gcc/testsuite/g++.dg/template/local6.C | 2 +- 21 files changed, 116 insertions(+), 92 deletions(-) diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index db9eb1a55cfc..f820419ee4ff 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -4134,6 +4134,16 @@ print_z_candidates (location_t loc, struct z_candidate *candidates, auto_diagnostic_nesting_level sentinel; + int num_candidates = 0; + for (auto iter = candidates; iter; iter = iter->next) + ++num_candidates; + + inform_n (loc, + num_candidates, "we found %i candidate", "we found %i candidates", + num_candidates); + auto_diagnostic_nesting_level sentinel2; + + int candidate_idx = 0; for (; candidates; candidates = candidates->next) { if (only_viable_p.is_true () && candidates->viable != 1) @@ -4144,7 +4154,11 @@ print_z_candidates (location_t loc, struct z_candidate *candidates, "use %<-fdiagnostics-all-candidates%> to display them"); break; } - print_z_candidate (loc, N_("candidate:"), candidates); + pretty_printer pp; + pp_printf (&pp, N_("candidate %i:"), candidate_idx + 1); + const char *const msgstr = pp_formatted_text (&pp); + print_z_candidate (loc, msgstr, candidates); + ++candidate_idx; } } diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic9.C b/gcc/testsuite/g++.dg/concepts/diagnostic9.C index 8eecfe6f81dd..e3617145ac12 100644 --- a/gcc/testsuite/g++.dg/concepts/diagnostic9.C +++ b/gcc/testsuite/g++.dg/concepts/diagnostic9.C @@ -1,7 +1,7 @@ // PR c++/85278 // { dg-do compile { target concepts } } -// { dg-message "candidate: .*const decltype\\(f2::a\\)&&" "" { target *-*-* } .+2 } +// { dg-message "candidate 1: .*const decltype\\(f2::a\\)&&" "" { target *-*-* } .+2 } template<typename T> void f2(T a) requires requires (const decltype(a) &&x) { -x; } diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C index 5965e25f2563..58c5652058e5 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C @@ -26,16 +26,17 @@ int main() { } /* { dg-begin-multiline-output "" } - * note: candidate: 'template<class auto:1> requires pettable<auto:1> void pet(auto:1)' - * note: template argument deduction/substitution failed: - * note: constraints not satisfied - * In substitution of 'template<class auto:1> requires pettable<auto:1> void pet(auto:1) [with auto:1 = lizard]': - * required from here - * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] - * note: no operand of the disjunction is satisfied - * note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail - * note: candidate: 'void pet(dog)' - * note: no known conversion for argument 1 from 'lizard' to 'dog' - * note: candidate: 'void pet(cat)' - * note: no known conversion for argument 1 from 'lizard' to 'cat' + * note: we found 3 candidates + * note: candidate 1: 'template<class auto:1> requires pettable<auto:1> void pet(auto:1)' + * note: template argument deduction/substitution failed: + * note: constraints not satisfied + * In substitution of 'template<class auto:1> requires pettable<auto:1> void pet(auto:1) [with auto:1 = lizard]': + * required from here + * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] + * note: no operand of the disjunction is satisfied + * note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail + * note: candidate 2: 'void pet(dog)' + * note: no known conversion for argument 1 from 'lizard' to 'dog' + * note: candidate 3: 'void pet(cat)' + * note: no known conversion for argument 1 from 'lizard' to 'cat' { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C index a4a2f4eb139f..69f7179172ee 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C @@ -27,25 +27,26 @@ int main() { } /* { dg-begin-multiline-output "" } - * note: candidate: 'template<class auto:1> requires pettable<auto:1> void pet(auto:1)' - * note: template argument deduction/substitution failed: - * note: constraints not satisfied - * In substitution of 'template<class auto:1> requires pettable<auto:1> void pet(auto:1) [with auto:1 = lizard]': - * required from here - * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] - * note: no operand of the disjunction is satisfied - * note: the operand 'has_member_pet<T>' is unsatisfied because - * required for the satisfaction of 'has_member_pet<T>' [with T = lizard] - * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] - * in requirements with 'T t' [with T = lizard] - * note: the required expression 't.pet()' is invalid, because - * error: 'struct lizard' has no member named 'pet' - * note: the operand 'has_default_pet<T>' is unsatisfied because - * required for the satisfaction of 'has_default_pet<T>' [with T = lizard] - * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] - * error: 'is_pettable' is not a member of 'lizard' - * note: candidate: 'void pet(dog)' - * note: no known conversion for argument 1 from 'lizard' to 'dog' - * note: candidate: 'void pet(cat)' - * note: no known conversion for argument 1 from 'lizard' to 'cat' + * note: we found 3 candidates + * note: candidate 1: 'template<class auto:1> requires pettable<auto:1> void pet(auto:1)' + * note: template argument deduction/substitution failed: + * note: constraints not satisfied + * In substitution of 'template<class auto:1> requires pettable<auto:1> void pet(auto:1) [with auto:1 = lizard]': + * required from here + * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] + * note: no operand of the disjunction is satisfied + * note: the operand 'has_member_pet<T>' is unsatisfied because + * required for the satisfaction of 'has_member_pet<T>' [with T = lizard] + * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] + * in requirements with 'T t' [with T = lizard] + * note: the required expression 't.pet()' is invalid, because + * error: 'struct lizard' has no member named 'pet' + * note: the operand 'has_default_pet<T>' is unsatisfied because + * required for the satisfaction of 'has_default_pet<T>' [with T = lizard] + * required for the satisfaction of 'pettable<auto:1>' [with auto:1 = lizard] + * error: 'is_pettable' is not a member of 'lizard' + * note: candidate 2: 'void pet(dog)' + * note: no known conversion for argument 1 from 'lizard' to 'dog' + * note: candidate 3: 'void pet(cat)' + * note: no known conversion for argument 1 from 'lizard' to 'cat' { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C index 0c5cc0152979..5ce7c68dcccb 100644 --- a/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C +++ b/gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C @@ -21,17 +21,18 @@ int main() { } /* { dg-begin-multiline-output "" } - * note: candidate: 'template<class T> requires pettable<T> void pet(T)' - * note: template argument deduction/substitution failed: - * note: constraints not satisfied - * In substitution of 'template<class T> requires pettable<T> void pet(T) [with T = donkey]': - * required from here - * required for the satisfaction of 'pettable<T>' [with T = donkey] - * in requirements with 'T t' [with T = donkey] - * note: the required expression 't.pet()' is invalid - * note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail - * note: candidate: 'void pet(dog)' - * note: no known conversion for argument 1 from 'donkey' to 'dog' - * note: candidate: 'void pet(cat)' - * note: no known conversion for argument 1 from 'donkey' to 'cat' + * note: we found 3 candidates + * note: candidate 1: 'template<class T> requires pettable<T> void pet(T)' + * note: template argument deduction/substitution failed: + * note: constraints not satisfied + * In substitution of 'template<class T> requires pettable<T> void pet(T) [with T = donkey]': + * required from here + * required for the satisfaction of 'pettable<T>' [with T = donkey] + * in requirements with 'T t' [with T = donkey] + * note: the required expression 't.pet()' is invalid + * note: set '-fconcepts-diagnostics-depth=' to at least 2 for more detail + * note: candidate 2: 'void pet(dog)' + * note: no known conversion for argument 1 from 'donkey' to 'dog' + * note: candidate 3: 'void pet(cat)' + * note: no known conversion for argument 1 from 'donkey' to 'cat' { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda11.C b/gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda11.C index 7f2bdb809d3b..789e90178fb0 100644 --- a/gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda11.C +++ b/gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda11.C @@ -26,8 +26,9 @@ void test1() auto s1 = S1{[x = 0](this auto&& self) { return self; }}; // { dg-line t1_s1 } s1.operator()<int>(); // { dg-error {no matching function for call to} } + // { dg-note {we found 1 candidate} {} { target *-*-* } .-1 } } -// { dg-note {candidate:} {} { target *-*-* } t1_s1 } +// { dg-note {candidate 1:} {} { target *-*-* } t1_s1 } // { dg-note {template argument deduction/substitution failed} {} { target *-*-* } t1_s1 } // { dg-error {a lambda with captures may not have an explicit object parameter of an unrelated type} {} { target *-*-* } t1_s1 } diff --git a/gcc/testsuite/g++.dg/cpp2a/desig4.C b/gcc/testsuite/g++.dg/cpp2a/desig4.C index 6f53ad42466d..458bd49c3004 100644 --- a/gcc/testsuite/g++.dg/cpp2a/desig4.C +++ b/gcc/testsuite/g++.dg/cpp2a/desig4.C @@ -5,8 +5,8 @@ struct A { int x, y; }; struct B { int y, x; }; void f(A a, int); // #1 void f(B b, ...); // #2 -void g(A a); // #3 { dg-message "candidate:" } -void g(B b); // #4 { dg-message "candidate:" } +void g(A a); // #3 { dg-message "candidate 1:" } +void g(B b); // #4 { dg-message "candidate 2:" } void h() { f({.x = 1, .y = 2}, 0); // OK; calls #1 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp2a/desig6.C b/gcc/testsuite/g++.dg/cpp2a/desig6.C index a2d0a1036a41..5dbbe46964ad 100644 --- a/gcc/testsuite/g++.dg/cpp2a/desig6.C +++ b/gcc/testsuite/g++.dg/cpp2a/desig6.C @@ -5,8 +5,8 @@ struct A { int x, z, y; }; struct B { int y, a, x; }; void f(A a, int); // #1 void f(B b, ...); // #2 -void g(A a); // #3 { dg-message "candidate:" } -void g(B b); // #4 { dg-message "candidate:" } +void g(A a); // #3 { dg-message "candidate 1:" } +void g(B b); // #4 { dg-message "candidate 2:" } void h() { f({.x = 1, .y = 2}, 0); // OK; calls #1 // { dg-warning "extended initializer lists only available with" "" { target c++98_only } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C index dc509563140e..d371d9b08bbc 100644 --- a/gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C @@ -31,18 +31,18 @@ bool c = C3{} == C3{}; struct D { D (); D (int *); - bool operator== (const D &) const; // { dg-message "candidate: 'bool D::operator==\\\(const D&\\\) const' \\\(reversed\\\)" } + bool operator== (const D &) const; // { dg-message "candidate 1: 'bool D::operator==\\\(const D&\\\) const' \\\(reversed\\\)" } operator int * () const; }; bool d = nullptr != D{}; // { dg-error "ambiguous overload for 'operator!=' in 'nullptr != D\\\(\\\)' \\\(operand types are 'std::nullptr_t' and 'D'\\\)" } - // { dg-message "candidate: 'operator!=\\\(int\\\*, int\\\*\\\)' \\\(built-in\\\)" "" { target *-*-* } .-1 } + // { dg-message "candidate 2: 'operator!=\\\(int\\\*, int\\\*\\\)' \\\(built-in\\\)" "" { target *-*-* } .-1 } using ubool = unsigned char; struct E { operator bool () const; }; -unsigned char operator== (E, E);// { dg-message "candidate: 'unsigned char operator==\\\(E, E\\\)'" } +unsigned char operator== (E, E);// { dg-message "candidate 2: 'unsigned char operator==\\\(E, E\\\)'" } // { dg-message "no known conversion for argument 1 from 'int' to 'E'" "" { target *-*-* } .-1 } unsigned char e = E{} != E{}; // { dg-error "return type of 'unsigned char operator==\\\(E, E\\\)' is not 'bool'" } // { dg-message "used as rewritten candidate for comparison of 'E' and 'E'" "" { target *-*-* } .-1 } @@ -50,7 +50,7 @@ unsigned char e = E{} != E{}; // { dg-error "return type of 'unsigned char opera // F-H are the testcase from [over.match.oper] struct F {}; template <typename T> -bool operator== (F, T); // { dg-message "candidate: 'template<class T> bool operator==\\\(F, T\\\)'" } +bool operator== (F, T); // { dg-message "candidate 1: 'template<class T> bool operator==\\\(F, T\\\)'" } // { dg-message "template argument deduction/substitution failed:" "" { target *-*-* } .-1 } bool f1 = 0 == F (); // OK, calls reversed == template <typename T> diff --git a/gcc/testsuite/g++.dg/diagnostic/function-color1.C b/gcc/testsuite/g++.dg/diagnostic/function-color1.C index 32d9e966bdbd..b9814fe10c7f 100644 --- a/gcc/testsuite/g++.dg/diagnostic/function-color1.C +++ b/gcc/testsuite/g++.dg/diagnostic/function-color1.C @@ -13,7 +13,7 @@ int main() call of overloaded '[01m[Kf<int>(int)[m[K' is ambiguous { dg-end-multiline-output "" } */ /* { dg-begin-multiline-output "" } -candidate: '[01m[Kvoid[01;32m[K f[m[K(short int) [35m[K[with T = int][m[K[m[K' +candidate 1: '[01m[Kvoid[01;32m[K f[m[K(short int) [35m[K[with T = int][m[K[m[K' { dg-end-multiline-output "" } */ } diff --git a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C index 50c25cd49b73..bb0bb1e3a6d5 100644 --- a/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C +++ b/gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C @@ -201,14 +201,20 @@ int test_10 () { s10 v10_a, v10_b; - return v10_a - v10_b; // { dg-error "no match for" } + return v10_a - v10_b; // { dg-line s10_usage } + // { dg-error "no match for" "" { target *-*-* } s10_usage } /* { dg-begin-multiline-output "" } return v10_a - v10_b; ~~~~~ ^ ~~~~~ | | s10 s10 { dg-end-multiline-output "" } */ - // { dg-message "candidate" "" { target *-*-* } s10_operator } + // { dg-message "we found 1 candidate" "" { target *-*-* } s10_usage } + /* { dg-begin-multiline-output "" } + return v10_a - v10_b; + ~~~~~~^~~~~~~ + { dg-end-multiline-output "" } */ + // { dg-message "candidate 1:" "" { target *-*-* } s10_operator } /* { dg-begin-multiline-output "" } extern int operator- (const s10&, int); ^~~~~~~~ diff --git a/gcc/testsuite/g++.dg/diagnostic/pr100716-1.C b/gcc/testsuite/g++.dg/diagnostic/pr100716-1.C index 93490da6a83a..ff78a37bbd2a 100644 --- a/gcc/testsuite/g++.dg/diagnostic/pr100716-1.C +++ b/gcc/testsuite/g++.dg/diagnostic/pr100716-1.C @@ -32,23 +32,23 @@ struct C int main() { A<int>().f(0); // { dg-error "no matching function for call to 'A<int>::f\\(int\\)'" } - // { dg-message "candidate: 'template<class U> void A<int>::f\\(\\)'" "" { target *-*-* } Af } + // { dg-message "candidate 1: 'template<class U> void A<int>::f\\(\\)'" "" { target *-*-* } Af } A<int>().g(); // { dg-error "no matching function for call to 'A<int>::g\\(\\)'" } - // { dg-message "candidate: 'template<class U> void A<int>::g\\(U\\)'" "" { target *-*-* } Ag } + // { dg-message "candidate 1: 'template<class U> void A<int>::g\\(U\\)'" "" { target *-*-* } Ag } B<int>().f(); // { dg-error "no matching function for call to 'B<int>::f\\(\\)'" } - // { dg-message "candidate: 'template<class U> void B<int>::f\\(U\\)'" "" { target *-*-* } Bf } + // { dg-message "candidate 1: 'template<class U> void B<int>::f\\(U\\)'" "" { target *-*-* } Bf } B<int>().g(); // { dg-error "no matching function for call to 'B<int>::g\\(\\)'" } - // { dg-message "candidate: 'template<class U> void B<int>::g\\(U, int\\)'" "" { target *-*-* } Bg } + // { dg-message "candidate 1: 'template<class U> void B<int>::g\\(U, int\\)'" "" { target *-*-* } Bg } B<float>().g(0); // { dg-error "no matching function for call to 'B<float>::g\\(int\\)'" } - // { dg-message "candidate: 'template<class U> void B<float>::g\\(U, float\\)'" "" { target *-*-* } Bg } + // { dg-message "candidate 1: 'template<class U> void B<float>::g\\(U, float\\)'" "" { target *-*-* } Bg } C().f(); // { dg-error "no matching function for call to 'C::f\\(\\)'" } - // { dg-message "candidate: 'template<class U> void C::f\\(U\\)'" "" { target *-*-* } Cf } + // { dg-message "candidate 1: 'template<class U> void C::f\\(U\\)'" "" { target *-*-* } Cf } C().g(0); // { dg-error "no matching function for call to 'C::g\\(int\\)'" } - // { dg-message "candidate: 'template<class U> void C::g\\(\\)'" "" { target *-*-* } Cg } + // { dg-message "candidate 1: 'template<class U> void C::g\\(\\)'" "" { target *-*-* } Cg } } diff --git a/gcc/testsuite/g++.dg/diagnostic/pr100716.C b/gcc/testsuite/g++.dg/diagnostic/pr100716.C index 4a1f0a4e10a3..e3b0ac24b31a 100644 --- a/gcc/testsuite/g++.dg/diagnostic/pr100716.C +++ b/gcc/testsuite/g++.dg/diagnostic/pr100716.C @@ -32,23 +32,23 @@ struct C int main() { A<int>().f(0); // { dg-error "no matching function for call to 'A<int>::f\\(int\\)'" } - // { dg-message "candidate: 'template<class U> void A<T>::f\\(\\) \\\[with T = int\\\]'" "" { target *-*-* } Af } + // { dg-message "candidate 1: 'template<class U> void A<T>::f\\(\\) \\\[with T = int\\\]'" "" { target *-*-* } Af } A<int>().g(); // { dg-error "no matching function for call to 'A<int>::g\\(\\)'" } - // { dg-message "candidate: 'template<class U> void A<T>::g\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Ag } + // { dg-message "candidate 1: 'template<class U> void A<T>::g\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Ag } B<int>().f(); // { dg-error "no matching function for call to 'B<int>::f\\(\\)'" } - // { dg-message "candidate: 'template<class U> void B<T>::f\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Bf } + // { dg-message "candidate 1: 'template<class U> void B<T>::f\\(U\\) \\\[with T = int\\\]'" "" { target *-*-* } Bf } B<int>().g(); // { dg-error "no matching function for call to 'B<int>::g\\(\\)'" } - // { dg-message "candidate: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = int\\\]'" "" { target *-*-* } Bg } + // { dg-message "candidate 1: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = int\\\]'" "" { target *-*-* } Bg } B<float>().g(0); // { dg-error "no matching function for call to 'B<float>::g\\(int\\)'" } - // { dg-message "candidate: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = float\\\]'" "" { target *-*-* } Bg } + // { dg-message "candidate 1: 'template<class U> void B<T>::g\\(U, T\\) \\\[with T = float\\\]'" "" { target *-*-* } Bg } C().f(); // { dg-error "no matching function for call to 'C::f\\(\\)'" } - // { dg-message "candidate: 'template<class U> void C::f\\(U\\)'" "" { target *-*-* } Cf } + // { dg-message "candidate 1: 'template<class U> void C::f\\(U\\)'" "" { target *-*-* } Cf } C().g(0); // { dg-error "no matching function for call to 'C::g\\(int\\)'" } - // { dg-message "candidate: 'template<class U> void C::g\\(\\)'" "" { target *-*-* } Cg } + // { dg-message "candidate 1: 'template<class U> void C::g\\(\\)'" "" { target *-*-* } Cg } } diff --git a/gcc/testsuite/g++.dg/lookup/operator-2.C b/gcc/testsuite/g++.dg/lookup/operator-2.C index 46d1d19daf22..38b55371ee84 100644 --- a/gcc/testsuite/g++.dg/lookup/operator-2.C +++ b/gcc/testsuite/g++.dg/lookup/operator-2.C @@ -1,7 +1,7 @@ // { dg-do compile { target c++11 } } struct R{}; -bool operator! (R); // { dg-message "candidate:" } +bool operator! (R); // { dg-message "candidate .:" } template <typename T> bool Foo (T x) { diff --git a/gcc/testsuite/g++.dg/lookup/pr80891-5.C b/gcc/testsuite/g++.dg/lookup/pr80891-5.C index 10d1ce3f3d52..ca2aae0f4b85 100644 --- a/gcc/testsuite/g++.dg/lookup/pr80891-5.C +++ b/gcc/testsuite/g++.dg/lookup/pr80891-5.C @@ -2,9 +2,9 @@ // ICE copying an augmented lookup during ADL -struct __normal_iterator get(); // { dg-message "candidate: .__normal_iterator get\\(\\)." } +struct __normal_iterator get(); // { dg-message "candidate .: .__normal_iterator get\\(\\)." } namespace boost { -template <class> void get(); // { dg-message "candidate: .template<class> void boost::get\\(\\)." } +template <class> void get(); // { dg-message "candidate .: .template<class> void boost::get\\(\\)." } struct A { A(int); }; @@ -64,6 +64,6 @@ struct C { A graph1_; A graph2_; }; -template <typename> void get(); // { dg-message "candidate: .template<class> void get\\(\\)." } +template <typename> void get(); // { dg-message "candidate .: .template<class> void get\\(\\)." } void test_vf2_sub_graph_iso() { C a(vf2_subgraph_iso(0, 0, a, 0, 0, 0, 0, 0)); } diff --git a/gcc/testsuite/g++.dg/modules/adhoc-1_b.C b/gcc/testsuite/g++.dg/modules/adhoc-1_b.C index 7fd5701463ed..78e48f3adcc6 100644 --- a/gcc/testsuite/g++.dg/modules/adhoc-1_b.C +++ b/gcc/testsuite/g++.dg/modules/adhoc-1_b.C @@ -7,7 +7,7 @@ void foo () } // { dg-regexp "\n\[^\n]*adhoc-1_b.C:6:73: error: no matching function for call to 'massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea\\(\\)'\n massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(\\);\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\^~$" } -// { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:5:12: note: candidate: 'int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(int\\)'\n export int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(int\\);\n \\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$" } -// { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:6:188: note: candidate: 'void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(float\\)'\n\[ \t]*export void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(float\\);\n\[ \t]*\\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~?$" } +// { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:5:12: note: candidate 2: 'int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(int\\)'\n export int massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(int\\);\n \\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$" } +// { dg-regexp "\nIn module bob, imported at \[^\n]*adhoc-1_b.C:3:\n\[^\n]*adhoc-1_a.C:6:188: note: candidate 1: 'void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea@bob\\(float\\)'\n\[ \t]*export void massivelongnamethatcausesadhoclocationsokeepaddingcharsyourgettheidea \\(float\\);\n\[ \t]*\\^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~?$" } // For some reason dg-regexp inserts a blank line // { dg-allow-blank-lines-in-output 1 } diff --git a/gcc/testsuite/g++.dg/modules/err-1_c.C b/gcc/testsuite/g++.dg/modules/err-1_c.C index 3a93cc6d18b9..dd65b55008dd 100644 --- a/gcc/testsuite/g++.dg/modules/err-1_c.C +++ b/gcc/testsuite/g++.dg/modules/err-1_c.C @@ -6,8 +6,8 @@ void One () Frob (0, 0, 0L); Frob (0, 0L, 0); Frob (0L, 0, 0); // { dg-error "ambiguous" } - // { dg-regexp {candidate: 'int Frob@Foo\(int, long int, int\)'} } - // { dg-regexp {candidate: 'int Frob@Foo\(int, int, long int\)'} } + // { dg-regexp {candidate 1: 'int Frob@Foo\(int, long int, int\)'} } + // { dg-regexp {candidate 2: 'int Frob@Foo\(int, int, long int\)'} } } import Bar; @@ -16,7 +16,7 @@ void Two () { Frob (0L, 0, 0); Frob (0, 0, 0); // { dg-error "ambiguous" } - // { dg-regexp {candidate: 'int Frob@Foo\(int, long int, int\)'} } - // { dg-regexp {candidate: 'int Frob@Foo\(int, int, long int\)'} } - // { dg-regexp {candidate: 'int Frob@Bar\(long int, int, int\)'} } + // { dg-regexp {candidate 1: 'int Frob@Foo\(int, long int, int\)'} } + // { dg-regexp {candidate 2: 'int Frob@Foo\(int, int, long int\)'} } + // { dg-regexp {candidate 3: 'int Frob@Bar\(long int, int, int\)'} } } diff --git a/gcc/testsuite/g++.dg/modules/err-1_d.C b/gcc/testsuite/g++.dg/modules/err-1_d.C index eb6b4ba7c99e..6bbe033cb77a 100644 --- a/gcc/testsuite/g++.dg/modules/err-1_d.C +++ b/gcc/testsuite/g++.dg/modules/err-1_d.C @@ -8,7 +8,7 @@ void Three () Frob (0L, 0, 0); Frob (0, 0, 0); // { dg-error "ambiguous" } - // { dg-regexp {candidate: 'int Frob@Foo\(int, long int, int\)'} } - // { dg-regexp {candidate: 'int Frob@Foo\(int, int, long int\)'} } - // { dg-regexp {candidate: 'int Frob@Bar\(long int, int, int\)'} } + // { dg-regexp {candidate 1: 'int Frob@Foo\(int, long int, int\)'} } + // { dg-regexp {candidate 2: 'int Frob@Foo\(int, int, long int\)'} } + // { dg-regexp {candidate 3: 'int Frob@Bar\(long int, int, int\)'} } } diff --git a/gcc/testsuite/g++.dg/other/return2.C b/gcc/testsuite/g++.dg/other/return2.C index b328fa6b5f7c..cbff027edf3b 100644 --- a/gcc/testsuite/g++.dg/other/return2.C +++ b/gcc/testsuite/g++.dg/other/return2.C @@ -4,4 +4,4 @@ void f(char); void g() { return f(42); // { dg-error "ambiguous" } -} // { dg-bogus "void" "" { target *-*-* } .-1 } +} // { dg-bogus "1: void" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/overload/error6.C b/gcc/testsuite/g++.dg/overload/error6.C index 3186a297bfc9..d144f3f288d7 100644 --- a/gcc/testsuite/g++.dg/overload/error6.C +++ b/gcc/testsuite/g++.dg/overload/error6.C @@ -2,8 +2,8 @@ // overload resolution failure for a template-id. // { dg-additional-options "-fdiagnostics-all-candidates" } -template<class T> void f(T); // { dg-message "candidate" } -void f(int); // { dg-message {candidate: 'void f\(int\)' \(ignored\)} } +template<class T> void f(T); // { dg-message "candidate .:" } +void f(int); // { dg-message {candidate .: 'void f\(int\)' \(ignored\)} } int main() { f<int>(0, 0); // { dg-error "no match" } diff --git a/gcc/testsuite/g++.dg/template/local6.C b/gcc/testsuite/g++.dg/template/local6.C index d8ca5aa66ebb..16a8bd51f058 100644 --- a/gcc/testsuite/g++.dg/template/local6.C +++ b/gcc/testsuite/g++.dg/template/local6.C @@ -1,6 +1,6 @@ template <class T> struct PCVector2 // { dg-message "note" } { - template <class T2> PCVector2(const PCVector2<T> &cv) ; // { dg-message "candidate:" } + template <class T2> PCVector2(const PCVector2<T> &cv) ; // { dg-message "candidate .:" } // { dg-message "(candidate|expects 1 argument, 2 provided|cannot convert)" "candidate note" { target *-*-* } .-1 } PCVector2<T> operator- (const PCVector2<T> &ov) const -- 2.26.3