<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - decltype((x)) inside lambda is considered odr-use if x is captured"
href="https://bugs.llvm.org/show_bug.cgi?id=35423">bug 35423</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - decltype((x)) inside lambda is considered odr-use if x is captured"
href="https://bugs.llvm.org/show_bug.cgi?id=35423#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - decltype((x)) inside lambda is considered odr-use if x is captured"
href="https://bugs.llvm.org/show_bug.cgi?id=35423">bug 35423</a>
from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
<pre>Prior to P0588R1:
[expr.prim.lambda.capture]/14:
"Every occurrence of decltype((x)) where x is a possibly parenthesized
id-expression that names an entity of automatic storage duration is treated as
if x were transformed into an access to a corresponding data member of the
closure type that would have been declared if x were an odr-use of the denoted
entity."
This is clear that Clang is correct that B and D give decltype((x)) as const
int&, not int&. But the types of A and C are unclear.
After P0588R1, the wording is a bit clearer:
[expr.prim.id.unqual]/1:
"If the entity is a local entity and naming it from outside of an unevaluated
operand within the declarative region where the unqualified-id appears would
result in some intervening lambda-expression capturing it by copy, the type of
the expression is the type of a class member access expression ([expr.ref])
naming the non-static data member that would be declared for such a capture in
the closure object of the innermost such intervening lambda-expression. [ Note:
If that lambda-expression is not declared mutable, the type of such an
identifier will typically be const qualified. ]"
Here we see that A and C should have type int& and B and D should have type
const int&.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>