https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101515
--- Comment #6 from qinzhao at gcc dot gnu.org --- the following patch fixed this bug: [opc@qinzhao-aarch64-ol8 latest_gcc]$ git diff diff --git a/gcc/cp/cxx-pretty-print.cc b/gcc/cp/cxx-pretty-print.cc index 4f9a090e520d..744ed0add5ba 100644 --- a/gcc/cp/cxx-pretty-print.cc +++ b/gcc/cp/cxx-pretty-print.cc @@ -171,7 +171,10 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t) case ENUMERAL_TYPE: case TYPENAME_TYPE: case UNBOUND_CLASS_TEMPLATE: - pp_cxx_unqualified_id (pp, TYPE_NAME (t)); + if (TYPE_NAME (t)) + pp_cxx_unqualified_id (pp, TYPE_NAME (t)); + else + pp_string (pp, "<unnamed type>"); if (tree ti = TYPE_TEMPLATE_INFO_MAYBE_ALIAS (t)) if (PRIMARY_TEMPLATE_P (TI_TEMPLATE (ti))) {