]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: print z candidate count and number them (v2)
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 11 Dec 2024 15:24:26 +0000 (10:24 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 11 Dec 2024 15:24:26 +0000 (10:24 -0500)
Changed in v2: changed wording to "there is"/"there are" rather
than "we found".

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.

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 <dmalcolm@redhat.com>
21 files changed:
gcc/cp/call.cc
gcc/testsuite/g++.dg/concepts/diagnostic9.C
gcc/testsuite/g++.dg/concepts/nested-diagnostics-1-truncated.C
gcc/testsuite/g++.dg/concepts/nested-diagnostics-1.C
gcc/testsuite/g++.dg/concepts/nested-diagnostics-2.C
gcc/testsuite/g++.dg/cpp23/explicit-obj-lambda11.C
gcc/testsuite/g++.dg/cpp2a/desig4.C
gcc/testsuite/g++.dg/cpp2a/desig6.C
gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C
gcc/testsuite/g++.dg/diagnostic/function-color1.C
gcc/testsuite/g++.dg/diagnostic/param-type-mismatch-2.C
gcc/testsuite/g++.dg/diagnostic/pr100716-1.C
gcc/testsuite/g++.dg/diagnostic/pr100716.C
gcc/testsuite/g++.dg/lookup/operator-2.C
gcc/testsuite/g++.dg/lookup/pr80891-5.C
gcc/testsuite/g++.dg/modules/adhoc-1_b.C
gcc/testsuite/g++.dg/modules/err-1_c.C
gcc/testsuite/g++.dg/modules/err-1_d.C
gcc/testsuite/g++.dg/other/return2.C
gcc/testsuite/g++.dg/overload/error6.C
gcc/testsuite/g++.dg/template/local6.C

index 43f229d6f693e09abb8ca3652a1a31f359d3ad89..c8420db568ea1f5f395350b4997a7fc5ab4de99d 100644 (file)
@@ -4133,6 +4133,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, "there is %i candidate", "there are %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)
@@ -4143,7 +4153,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;
     }
 }
 
index 8eecfe6f81dd2b28d85a133247d2f4de32031fe6..e3617145ac125c84e99cd5635292177d09c943f7 100644 (file)
@@ -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; }
index 5965e25f2563a203be85a30265c818644be55805..3f1f494dcf517c387a95579e901e1f39a8495ecd 100644 (file)
@@ -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: there are 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 "" } */
index a4a2f4eb139f3b2c70d5099b6c21ceeb1bbd453a..8713046df6d7277e3f4d230bdd96f765e802805f 100644 (file)
@@ -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: there are 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 "" } */
index 0c5cc0152979e12ebca62e24b81d266b9e6e79fa..4205dbe8c75dfa4240b2ddce8daff4df43c8d87a 100644 (file)
@@ -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: there are 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 "" } */
index 7f2bdb809d3be6289a36bf0a6c6d6e413208ddd0..7957ad3e194306bbef9b458b06cfad16321eea4d 100644 (file)
@@ -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 {there is 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 }
 
index 6f53ad42466d16eed8b7861ece298fa153489481..458bd49c3004bec6327b0e0ac3a2c5c179312ef8 100644 (file)
@@ -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 }
index a2d0a1036a41a58e417bf254a457425bf02312e7..5dbbe46964ad9ba199102eebebdeaaf98e409b39 100644 (file)
@@ -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 }
index dc509563140e323ce4a6669d0521c6f99aa6ce81..d371d9b08bbc240f5e7eb4974752e79a2da52fba 100644 (file)
@@ -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>
index 32d9e966bdbd8ce1582f3c2fa41c73a32fd01c12..b9814fe10c7f8892f89a06b89424567ddcf5d268 100644 (file)
@@ -13,7 +13,7 @@ int main()
 call of overloaded '\e[01m\e[Kf<int>(int)\e[m\e[K' is ambiguous
      { dg-end-multiline-output "" } */
   /* { dg-begin-multiline-output "" }
-candidate: '\e[01m\e[Kvoid\e[01;32m\e[K f\e[m\e[K(short int) \e[35m\e[K[with T = int]\e[m\e[K\e[m\e[K'
+candidate 1: '\e[01m\e[Kvoid\e[01;32m\e[K f\e[m\e[K(short int) \e[35m\e[K[with T = int]\e[m\e[K\e[m\e[K'
      { dg-end-multiline-output "" } */
 }
 
index 50c25cd49b736b29d29b587c389d4c71ff7c9567..e0fad77dfae410e1079421f2f4e3b973af20e739 100644 (file)
@@ -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 "there is 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);
             ^~~~~~~~
index 93490da6a83a6df365b78313db16508efd7cc19a..ff78a37bbd2a185b958d03f4315a2b76e64157d4 100644 (file)
@@ -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 }
 }
index 4a1f0a4e10a325319f7b8987a8d968c0c0adbc1d..e3b0ac24b31aa9258a83e08978d9af83391a7618 100644 (file)
@@ -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 }
 }
index 46d1d19daf22831fc2a9a6fe128b7824fbefd5d4..38b55371ee8431ea382acf43135f80f62c7ce90d 100644 (file)
@@ -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)
 {
index 10d1ce3f3d52bad3f8f0c99a8aca0b7e0e87ae78..ca2aae0f4b855a3d86fc617166bda9a42ce41b43 100644 (file)
@@ -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));
 }
index 7fd5701463ed9b20592b5478b198efd5695f8520..78e48f3adcc61dc1e1514e39b2c1e59cbf52374f 100644 (file)
@@ -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 }
index 3a93cc6d18b925066c0b0f8dcb9cba3a89b14ce6..dd65b55008dd9da0e4737b7e231cbef061aa5ed1 100644 (file)
@@ -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\)'} }
 }
index eb6b4ba7c99ecd41d3027c2d5a8c389fc9a301e6..6bbe033cb77a63693390f49721589d9258115820 100644 (file)
@@ -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\)'} }
 }
index b328fa6b5f7cb71650683dae3c2dfb2b2df4568e..cbff027edf3b99bf767d5da5f4d17db0868df551 100644 (file)
@@ -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 }
index 3186a297bfc9fd008517232816d9d990ecbdbe2b..d144f3f288d7a8a108f4dc40d5a0e106f773b963 100644 (file)
@@ -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" }
index d8ca5aa66ebbf1c90bae38e5cb3af3c2c3a758cf..16a8bd51f05885fdbd36684923a8c8f1b99087d0 100644 (file)
@@ -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