]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: OVERLOAD in diagnostics
authorJason Merrill <jason@redhat.com>
Wed, 3 Jul 2024 21:25:53 +0000 (17:25 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 4 Jul 2024 02:04:50 +0000 (22:04 -0400)
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.

gcc/cp/error.cc
gcc/testsuite/g++.dg/warn/pr61945.C

index 171a352c85fd66bf400447a4612c33a278e3ea78..1f36563ae2ccd72b33ef8ebb4fe575e339508f39 100644 (file)
@@ -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))
index 3d40581e5e359fd0e6d94a64a43984f675f987b4..2252330835fb674ba870d75c3b34a6ece68e15a0 100644 (file)
@@ -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\\(\\)." }
 };