public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Lambda type names
@ 2021-11-12 12:20 Mario Demontis
  2021-11-12 12:34 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Demontis @ 2021-11-12 12:20 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Lambda type names
  2021-11-12 12:20 Lambda type names Mario Demontis
@ 2021-11-12 12:34 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2021-11-12 12:34 UTC (permalink / raw)
  To: Mario Demontis; +Cc: gcc-help

On Fri, 12 Nov 2021 at 12:21, Mario Demontis wrote:
>
> Hello
> Is there a way to make gcc add more info for each lambda defined in the
> same function?

No.


> 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.

And their python gdb.Type objects are equal too.

> 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)?

Please file a bug with the testcase from your first email.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-12 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 12:20 Lambda type names Mario Demontis
2021-11-12 12:34 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).