Skip to content

Commit

Permalink
Add numbering rule for lambdas in class bodies outside of default
Browse files Browse the repository at this point in the history
arguments and default member initializers.
  • Loading branch information
zygoloid committed Sep 9, 2019
1 parent d87d707 commit 9aba465
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions abi.html
Original file line number Diff line number Diff line change
Expand Up @@ -5570,6 +5570,7 @@ <h4><a href="#closure-types">5.1.8 Closure Types (Lambdas)</a></h4>
<li>default member initializers</li>
<li>the bodies of inline or templated functions</li>
<li>the initializers of inline or templated variables</li>
<li>the remaining contexts in class definitions</li>
</ul>

In all these contexts, the encoding of the closure types builds on an
Expand Down Expand Up @@ -5658,6 +5659,28 @@ <h4><a href="#closure-types">5.1.8 Closure Types (Lambdas)</a></h4>
// Corresponding operator(): _ZNK1SIiE1xMUlvE_clEv
</pre></code>

<p>
If the context is within a class definition,
and not within one of the above more specific cases,
the closure class and its members are encoded as follows:
<code><pre><font color=blue> &lt;<a href="#mangle.local-name">local-name</a>&gt; ::= Z &lt;<i>class</i> <a href="#mangle.name">name</a>&gt; E &lt;<i>entity</i> <a href="#mangle.name">name</a>&gt;
</font></pre></code>
As above, the <code>&lt;<i>entity</i> <a href="#mangle.name">name</a>&gt;</code> will contain a
<code>&lt;<a href="#mangle.closure-type-name">closure-type-name</a>&gt;</code>,
which is numbered within the class, counting only those closure types for which
this mangling rule applies.
For example:
<code><pre>
struct S {
// Template argument is LZ1SEUlvE_E; f&lt;true&gt; is _ZN1S1fILb1EEEv1XILZ1SEUlvE_EE
template&lt;bool B&gt; void f(X&lt;[]{ return B; }()&gt;) { ... }
int n = []{ return 0; }(); // not counted towards numbering in struct S
// Template argument is LZ1SEUlvE0_E; f&lt;true&gt; is _ZN1S1fILb1EEEv1XILZ1SEUlvE0_EE
template&lt;bool B&gt; void f(X&lt;[]{ return !B; }()&gt;) { ... }
};
</pre></code>


<p>
In a generic lambda, uses of <code>auto</code> in the parameter list
are mangled as the corresponding artificial template type parameter.
Expand Down

0 comments on commit 9aba465

Please sign in to comment.