https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102061

--- Comment #3 from Peter Damianov <peter0x44 at disroot dot org> ---
diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc
index 61f2b676256..89a89b74535 100644
--- a/gcc/langhooks.cc
+++ b/gcc/langhooks.cc
@@ -223,6 +223,8 @@ lhd_get_alias_set (tree ARG_UNUSED (t))
 const char *
 lhd_decl_printable_name (tree decl, int ARG_UNUSED (verbosity))
 {
+  while (DECL_ABSTRACT_ORIGIN(decl) && DECL_ABSTRACT_ORIGIN(decl) != decl)
+    decl = DECL_ABSTRACT_ORIGIN(decl);
   gcc_assert (decl && DECL_NAME (decl));
   return IDENTIFIER_POINTER (DECL_NAME (decl));
 }

This patch appears to fix the issue.
The call site of lhd_decl_printable_name is lhd_print_error_function, which I
suppose is used for warnings too.

          if (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE)
            pp_printf
              (context->printer, _("In member function %qs"),
               identifier_to_locale (lang_hooks.decl_printable_name (fndecl,
2)));
          else
            pp_printf
              (context->printer, _("In function %qs"),
               identifier_to_locale (lang_hooks.decl_printable_name (fndecl,
2)));

Reply via email to