<div dir="auto">> <span style="word-spacing:1px;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)">This is not a valid structured binding pack, it needs to be used in a</span><div><span style="font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:1px;text-decoration:none;float:none;display:inline!important;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)">template.</span></div><div dir="auto"><span style="word-spacing:1px;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)"><br></span></div><div dir="auto"><span style="word-spacing:1px;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)">Good catch, thanks for the correction!</span></div><div dir="auto"><span style="word-spacing:1px;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)"><br></span></div><div dir="auto"><span style="word-spacing:1px;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)"><div dir="auto"><span style="font-size:16px;font-style:normal;font-weight:400;letter-spacing:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline!important;background-color:rgba(0,0,0,0);border-color:rgb(0,0,0);color:rgb(0,0,0)">> Are there other places where the type pack would show up, other than as a template parameter? Might help inform the design a bit more.</span></div><br></span></div><div dir="auto"><span style="word-spacing:1px;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)">Not that I’m aware of (in C++). </span><span style="word-spacing:1px;float:none;display:inline!important;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)">Maybe other languages have additional uses of “type packs”. Haven’t checked that.</span><span style="word-spacing:1px;background-color:rgba(0,0,0,0);border-color:rgb(49,49,49);color:rgb(49,49,49)"> Though “type” may be not the most accurate name since one might have non-type template parameters in that list.</span></div><div dir="auto"><br></div></div><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, Sep 17, 2025 at 17:26 David Blaikie via Dwarf-discuss <<a href="mailto:dwarf-discuss@lists.dwarfstd.org">dwarf-discuss@lists.dwarfstd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr">Thanks for bringing this up/working on these features.<br><br>I certainly do like the generalization to DW_TAG_{type,variable}_pack.<br><br>Are there other places where the type pack would show up, other than as a template parameter? Might help inform the design a bit more.<br><br>I can't think of one, but I'd probably still vote for the name/generalization so it matches better with variable_pack, and maybe has some future uses we can't see yet.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 17, 2025 at 12:19 AM Michael Buch <<a href="mailto:m_buch@apple.com" target="_blank">m_buch@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div><div><div dir="auto">Hi all,</div><div dir="auto"><br></div><div dir="auto">I have been working on some LLDB/debug-info issues surrounding parameter packs recently and stumbled upon following DWARFv6 proposal: <font style="color:rgb(0,0,0)"><a href="https://dwarfstd.org/issues/250516.1.html" rel="nofollow" style="box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px" target="_blank">https://dwarfstd.org/issues/250516.1.html</a><span style="font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px"> </span></font></div><div dir="auto"><br></div><div dir="auto">I'm in favour of standardising parameter pack support in DWARF, but wanted to recommend a few changes to the above proposal to make sure we accommodate various use-cases not yet covered by it.</div><div dir="auto"><div><br></div><div>At the time of the proposal there were two kinds of packs</div><div>1. template parameter packs</div><div>2. function parameter packs</div><div><br></div><div>Since then two more kinds of packs have been added to the language:</div><div>3. lambda capture packs (C++20)</div><div>4. structured binding packs (C++26)</div><div><br></div><div>The proposal currently describes (1)<span style="color:rgb(0,0,0)"> as DW_TAG_template_parameter_pack and (2) as </span><span style="color:rgb(0,0,0)">DW_TAG_formal_parameter_pack</span></div><div><br></div><div>However, it seems to me that neither of these are suitable to describe (3) and (4).</div><div><br></div><div># Lambda Capture Packs</div><div><br></div><div>Here is an example of such pack:</div><div>```</div><div><span style="white-space:pre-wrap;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-variant-ligatures:none;text-decoration-style:initial;text-decoration-color:initial;background-color:rgba(232,232,232,0.04)"><font style="font-family:Monaco,Menlo,Consolas,"Courier New",monospace;color:rgb(0,0,0)">template <typename ... Args>
auto f(Args&& ... args){
return [... args = std::forward<Args>(args)] {
// use args
};
}</font></span></div><div>```</div><div><br></div><div>Here, `args` is actually a collection of init-capture declarations. In DWARF one might want to represent these as </div><div>`DW_TAG_member`s on the anonymous lambda structure. However, neither <span style="color:rgb(0,0,0)">DW_TAG_formal_parameter_pack nor </span><span style="color:rgb(0,0,0)">DW_TAG_template_parameter_pack would allow such a representation.</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)"># Structured Binding Packs</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><div style="color:rgb(0,0,0)">Here is an example of such pack:</div></div><div>```</div><div><pre style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:11.9px;margin-top:0px;overflow:auto;line-height:1.45;border-radius:6px;color:rgb(5,12,20)"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace;font-size:11.9px;padding:0px;margin:0px;background-image:none;background-position:0% 0%;background-size:auto;background-repeat:repeat;background-origin:padding-box;background-clip:border-box;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">struct C { int x = 1, y = 2, z = 3; };
void foo() {
auto [d, ...e] = C();
}</code></pre></div><div>```</div><div><br></div><div>Here, `e` is a collection of variable declarations. <span style="color:rgb(0,0,0)">In DWARF one might want to represent these as `DW_TAG_variable`s local to the function `foo`. But, again, neither of the proposed new tags currently allows this.</span></div><div><br></div><div>More discussion on that here: <a href="https://github.com/llvm/llvm-project/issues/152282" target="_blank">https://github.com/llvm/llvm-project/issues/152282</a></div><div><br></div><div># Proposed changes to the proposal</div><div><br></div><div><p dir="auto" style="box-sizing:border-box;margin-top:0px;color:rgb(5,12,20)">A more general representation for packs would be having the notion of a "type pack" and a "variable pack". The "type pack" is a collection of types, which is what<font face="monospace" style="font-family:monospace;color:rgb(5,12,20)"><span style="font-family:monospace"> DW_TAG_template_paramaeter_pack </span></font>encodes. A "variable pack" is a collection of variable declarations, which could be function parameters (<font face="monospace" style="font-family:monospace;color:rgb(5,12,20)"><span style="font-family:monospace">DW_TAG_formal_parameter</span></font>) or variables introduced with structured bindings (<font face="monospace" style="font-family:monospace;color:rgb(5,12,20)"><span style="font-family:monospace">DW_TAG_variable</span></font>) or even variables introduced via lambda capture packs <font face="monospace" style="font-family:monospace;color:rgb(5,12,20)"><span style="font-family:monospace">(DW_TAG_member</span></font> on the fake lambda structure).</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;color:rgb(5,12,20)"><br></p><p dir="auto" style="box-sizing:border-box;margin-top:0px;color:rgb(5,12,20)">That way we could represent the DWARF for<code style="box-sizing:border-box;padding:0.2em 0.4em;margin:0px;white-space:break-spaces;border-radius:6px;font-family:monospace">auto [a, ...e]</code> like so:</p><p dir="auto" style="box-sizing:border-box;margin-top:0px;color:rgb(5,12,20)">```</p><div style="box-sizing:border-box;overflow:auto;margin-bottom:0px;color:rgb(5,12,20)"><pre style="box-sizing:border-box;margin-top:0px;overflow:auto;line-height:1.45;border-radius:6px;font-family:monospace"><code style="box-sizing:border-box;padding:0px;margin:0px;background-image:none;background-position:0% 0%;background-size:auto;background-repeat:repeat;background-origin:padding-box;background-clip:border-box;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;font-family:monospace"><font face="Helvetica" style="font-family:Helvetica;color:rgb(5,12,20)">DW_TAG_variable
DW_AT_name ("a")
DW_TAG_variable_pack
DW_AT_name ("e")
DW_TAG_variable
DW_AT_type
DW_AT_name ("fake_var_1") << may or may not be needed. Debugger could synthesize this
DW_TAG_variable
DW_AT_type
DW_AT_name ("fake_var_2") << may or may not be needed. Debugger could synthesize this</font></code></pre><pre style="box-sizing:border-box;margin-top:0px;overflow:auto;line-height:1.45;border-radius:6px;font-family:monospace"><code style="box-sizing:border-box;padding:0px;margin:0px;background-image:none;background-position:0% 0%;background-size:auto;background-repeat:repeat;background-origin:padding-box;background-clip:border-box;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;font-family:monospace"><font face="Helvetica" style="font-family:Helvetica;color:rgb(5,12,20)">```</font></code></pre><pre style="box-sizing:border-box;margin-top:0px;overflow:auto;line-height:1.45;border-radius:6px;font-family:monospace"><code style="box-sizing:border-box;padding:0px;margin:0px;background-image:none;background-position:0% 0%;background-size:auto;background-repeat:repeat;background-origin:padding-box;background-clip:border-box;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;font-family:monospace"><font face="Helvetica" style="font-family:Helvetica;color:rgb(5,12,20)"><br></font></code></pre><pre style="box-sizing:border-box;margin-top:0px;overflow:auto;line-height:1.45;border-radius:6px;font-family:monospace"><code style="box-sizing:border-box;padding:0px;margin:0px;background-image:none;background-position:0% 0%;background-size:auto;background-repeat:repeat;background-origin:padding-box;background-clip:border-box;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;font-family:monospace"><font face="Helvetica" style="font-family:Helvetica;color:rgb(5,12,20)">Let me know if you have any questions/concerns with these suggestions. Happy to discuss!</font></code></pre></div></div></div></div></div></blockquote></div>
-- <br>
Dwarf-discuss mailing list<br>
<a href="mailto:Dwarf-discuss@lists.dwarfstd.org" target="_blank">Dwarf-discuss@lists.dwarfstd.org</a><br>
<a href="https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss" rel="noreferrer" target="_blank">https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss</a><br>
</blockquote></div></div>