https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101515
--- Comment #5 from qinzhao at gcc dot gnu.org --- the root cause for this bug is: 1. there is no NAME for the pointer to member function type as the following: (in cp/decl.cc) tree build_ptrmemfunc_type (tree type) { .... 10655 finish_builtin_struct (t, "__ptrmemfunc_type", fields, ptr_type_node); 10656 10657 /* Zap out the name so that the back end will give us the debugging 10658 information for this anonymous RECORD_TYPE. */ 10659 TYPE_NAME (t) = NULL_TREE; ... } 2. therefore, when printing this ptrmemfun type (which is a RECORD_TYPE), we should consider that it might not have a TYPE_NAME, however, in the current handling "pp_cxx_unqualified_id", the TYPE_NAME is assumed to be non-NULL, this is not correct. 126 static void 127 pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t) 128 { 129 enum tree_code code = TREE_CODE (t); 130 switch (code) ... 169 case RECORD_TYPE: 170 case UNION_TYPE: 171 case ENUMERAL_TYPE: 172 case TYPENAME_TYPE: 173 case UNBOUND_CLASS_TEMPLATE: 174 pp_cxx_unqualified_id (pp, TYPE_NAME (t)); ===> the ICE happens here due to TYPE_NAME is NULL.