Lambda type names

Mario Demontis mario.demontis@gmail.com
Fri Nov 12 12:20:04 GMT 2021


Hello
Is there a way to make gcc add more info for each lambda defined in the
same function?
E.g.:

auto l1 = [x = 5](int a){return x+a;};
auto l2 = [y = 6](int a){return y+1;};

If I want to wrap them into the same wrapper template class:

template<typename T>
struct Wrap{
   T w;
};

They would end up with the same name in gdb (e.g.:
function_name()::<lambda(int)>), causing an overlap in type
definitions.

Could it be possible to add more info (in the linking symbol a counter
is added, while clang adds the filename and line of definition)?


Thanks

Mario


More information about the Gcc-help mailing list