https://gcc.gnu.org/g:baac8f710e35cfea14060e5eca49dbb49ffc294d

commit r15-1832-gbaac8f710e35cfea14060e5eca49dbb49ffc294d
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed Jul 3 17:25:53 2024 -0400

    c++: OVERLOAD in diagnostics
    
    In modules we can get an OVERLOAD around a non-function, so let's tail
    recurse instead of falling through.  As a result we start printing the
    template header in this testcase.
    
    gcc/cp/ChangeLog:
    
            * error.cc (dump_decl) [OVERLOAD]: Recurse on single case.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/warn/pr61945.C: Adjust diagnostic.

Diff:
---
 gcc/cp/error.cc                     | 6 ++----
 gcc/testsuite/g++.dg/warn/pr61945.C | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index 171a352c85f..1f36563ae2c 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -1407,10 +1407,8 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
          break;
        }
 
-      /* If there's only one function, just treat it like an ordinary
-        FUNCTION_DECL.  */
-      t = OVL_FIRST (t);
-      /* Fall through.  */
+      /* If there's only one function, dump that.  */
+      return dump_decl (pp, OVL_FIRST (t), flags);
 
     case FUNCTION_DECL:
       if (! DECL_LANG_SPECIFIC (t))
diff --git a/gcc/testsuite/g++.dg/warn/pr61945.C 
b/gcc/testsuite/g++.dg/warn/pr61945.C
index 3d40581e5e3..2252330835f 100644
--- a/gcc/testsuite/g++.dg/warn/pr61945.C
+++ b/gcc/testsuite/g++.dg/warn/pr61945.C
@@ -7,5 +7,5 @@ class A {
 };
 class B : A {
   template <typename>
-  void foo ();         // { dg-message "by .B::foo\\(\\)." }
+  void foo ();         // { dg-message "by .*B::foo\\(\\)." }
 };

Reply via email to