https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115761

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> "f<f(T) [with T = f(T) [with T = f(T) [with T =
> int]::<lambda()>]::<lambda()>]::<lambda()> >"
> 
> 
> vs
> 
> "f<f<f<f<int>(int)::<lambda()> >(f<int>(int)::<lambda()>)::<lambda()>
> >(f<f<int>(int)::<lambda()>
> >(f<int>(int)::<lambda()>)::<lambda()>)::<lambda()> >"
> For the DW_AT_name
> 
> Clang just uses "f" or "f<(lambda at bug.cpp:3:12)>" for DW_AT_name. 
> 
> from https://wiki.dwarfstd.org/Best_Practices.md :
> For template instantiations, the DW_AT_name attribute should contain both
> the source language name of the object and the template parameters that
> distinguish one instantiation from another. The resulting string should be
> in the natural form for the language, and should have a canonical
> representation (i.e., different producers should generate the same
> representation). For C++, the string should match that produced by the
> target platform\’s canonical demangler; spaces should only be inserted where
> syntactically required by the compiler.
> 
> So GCC is following the best practices while clang is not.

Note the "and the template parameters that distinguish one instantiation from
another" is the key here really. In the case of clang, there is no
distinguishing between the second to inner most and outer most f. Both are
"f<(lambda at bug.cpp:3:12)>" which is wrong because the lambda type from
`f<int>` is a different type from `f<f<int>::lambda>` .

Reply via email to