[RFC][PATCH][PR gdb/24154] Use real type for member functions with auto return type
Hannes Domani
ssbssa@yahoo.de
Fri May 8 09:11:19 GMT 2020
Am Donnerstag, 7. Mai 2020, 23:48:00 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
> Hannes> For this code:
> Hannes> template<typename T>
> Hannes> struct X
> Hannes> {
> Hannes> T value;
> Hannes> auto get () { return value; }
> Hannes> };
> Hannes> X<int> x{1};
>
> Tom> What does the resulting DWARF look like?
> Tom> It would be good to have that in the commit message.
>
> I compiled it myself and with gcc 9.3 I get:
>
> <2><37>: Abbrev Number: 4 (DW_TAG_subprogram)
> <38> DW_AT_external : 1
> <38> DW_AT_name : get
> <3c> DW_AT_decl_file : 1
> <3d> DW_AT_decl_line : 5
> <3e> DW_AT_decl_column : 8
> <3f> DW_AT_linkage_name: (indirect string, offset: 0xb): _ZN1XIiE3getEv
> <43> DW_AT_type : <0x64>
> [...]
> <1><64>: Abbrev Number: 8 (DW_TAG_unspecified_type)
> <65> DW_AT_name : (indirect string, offset: 0x0): auto
>
>
> This just seems like a compiler bug to me, and I think the return type
> should either be 'int' or, ideally, the template parameter:
>
> <2><55>: Abbrev Number: 6 (DW_TAG_template_type_param)
> <56> DW_AT_name : T
> <58> DW_AT_type : <0x5d>
>
> In my case there's no specification so I don't see how gdb could do
> anything about this.
If there is no specification, then I think you're missing the actual use of
the function, like:
int
main (void)
{
return (x.get ());
}
Hannes
More information about the Gdb-patches
mailing list