https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125680
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <[email protected]>: https://gcc.gnu.org/g:4f751c0b701296bbeb63ff467c7c7e22a9075d19 commit r17-3024-g4f751c0b701296bbeb63ff467c7c7e22a9075d19 Author: Jakub Jelinek <[email protected]> Date: Thu Aug 6 12:24:15 2026 +0200 c++: Mangling fix for type alias reflections [PR125680] The following testcase ICEs, because we use write_unqualified_name to write the type alias name. Unfortunately, it is an alias for an unnamed type and write_unqualified_name in that case uses if (TREE_CODE (decl) == TYPE_DECL && enum_with_enumerator_for_linkage_p (type)) write_unnamed_enum_name (type); else if (TREE_CODE (decl) == TYPE_DECL && TYPE_UNNAMED_P (type)) write_unnamed_type_name (type); else if (TREE_CODE (decl) == TYPE_DECL && LAMBDA_TYPE_P (type)) write_closure_type_name (type); else write_source_name (DECL_NAME (decl)); and write_unnamed_type_node else if (TYPE_CLASS_SCOPE_P (type)) discriminator = nested_anon_class_index (type); and nested_anon_class_index ICEs, because type is the type alias and obviously it can't find a type alias among DECL_IMPLICIT_TYPEDEF_P nembers. In this case, we really want to write the source name of the type alias (which always should have DECL_NAME), regardless of what the dealias of the type alias is (that is emitted later in the mangling). Note, this isn't the only PR against this area, there is another one where write_prefix (decl_mangling_context (arg)); doesn't work properly for local names. 2026-08-06 Jakub Jelinek <[email protected]> PR c++/125680 * mangle.cc (write_reflection): For type aliases use maybe_write_module and write_source_name instead of write_unqualified_name. * g++.dg/reflect/mangle8.C: New test. Reviewed-by: Jason Merrill <[email protected]>
