https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94459
--- Comment #3 from Domani Hannes <ssbssa at yahoo dot de> --- (In reply to Jakub Jelinek from comment #1) > Looking through DW_TAG_const_type seems insufficient to me, can't there be > other qualifications (at least DW_TAG_volatile_type, perhaps in various > orders)? > So wouldn't be better a loop as long as die and die->die_tag is one of > dwarf_qual_info[?].t or DW_TAG_{rvalue_}reference, use die = get_AT_ref > (die, DW_AT_type); ? As suggested, I'm now using this: --- gcc/dwarf2out.c 2020-03-12 12:07:21.000000000 +0100 +++ gcc/dwarf2out.c 2020-04-02 20:10:05.829023900 +0200 @@ -23016,6 +23016,11 @@ if (is_cxx () && debug_info_level > DINFO_LEVEL_TERSE) { dw_die_ref die = get_AT_ref (old_die, DW_AT_type); + while (die->die_tag == DW_TAG_reference_type + || die->die_tag == DW_TAG_rvalue_reference_type + || die->die_tag == DW_TAG_const_type + || die->die_tag == DW_TAG_volatile_type) + die = get_AT_ref (die, DW_AT_type); if (die == auto_die || die == decltype_auto_die) add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)), TYPE_UNQUALIFIED, false, context_die); I don't think that restrict/atomic is possible for auto return types, but I may be wrong about that.