https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94162
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- At least the #c8 testcase got fixed with r12-619-gfc178519771db508c03611cff4a1466cf67fce1d but that hasn't been backported to 11.x. The ICE with int * return type is because POINTER_TYPE has NULL TYPE_LINKAGE_IDENTIFIER, and cat_type_for is called on such type. --- gcc/cp/method.c.jj 2021-06-28 22:38:27.014617793 +0200 +++ gcc/cp/method.c 2021-08-09 10:59:02.324443669 +0200 @@ -1029,6 +1029,8 @@ is_cat (tree type, comp_cat_tag tag) static comp_cat_tag cat_tag_for (tree type) { + if (!TYPE_LINKAGE_IDENTIFIER (type)) + return cc_last; for (int i = 0; i < cc_last; ++i) { comp_cat_tag tag = (comp_cat_tag)i; would fix this (or shall we instead test if (!CLASS_TYPE_P (type)) or something similar?