<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Apr 23, 2025 at 2:53 PM Kyle Huey <<a href="mailto:khuey@pernos.co">khuey@pernos.co</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Apr 23, 2025 at 2:20 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
>><br>
>> Do you object to anything I proposed other than removing the<br>
>> representation of the anonymous class compilers generate for lambdas?<br>
><br>
><br>
> I'm not a /super/ fan of introducing a bunch of locals in addition to the member descriptions - it'll be a bunch of extra DWARF that'd be nice to avoid if we can...<br>
<br>
Yeah, that would be the reason to get rid of the representation of the<br>
anonymous struct. Then we're just converting members into locals<br>
rather than duplicating anything. Even if you really want to keep the<br>
class itself, the members could be dropped.<br></blockquote><div><br>Except it's likely users will want to inspect the state of a lambda in some situations. They get passed around, stored (in std::functions or similar type-erased things, often), etc in many cases & may be important to know what they represent when not near/in a call to the lambda. So having the members described seems important.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> But putting object_pointer on the class member that stores "this" seems problematic since that's effectively at the same scope as the real object pointer - it'd be awkward to say there's two "this" at the same scope and have to say that the member variable "this" shadows the real "this" in some way.<br>
><br>
> And then you want the captured variables to be in a scope that is inside the "this" scope so they override unqualified lookup for any names that are also members of "this"...<br>
><br>
> So, yeah, I get why you/gcc developers arrived where they did. I wouldn't mind some size analysis to see how bad the regression/cost is, that might help inform whether it's worth trying to address it.<br>
<br>
Hmm. I could look at hacking something up to measure but it's not at<br>
the top of my priority list.<br></blockquote><div><br>Fair. </div></div></div>