<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:bastienPenava@gmail.com" title="Bastien Penavayre <bastienPenava@gmail.com>"> <span class="fn">Bastien Penavayre</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - constexpr value in a lambda"
href="https://bugs.llvm.org/show_bug.cgi?id=25627">bug 25627</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>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>FIXED
</td>
<td>---
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>bastienPenava@gmail.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - constexpr value in a lambda"
href="https://bugs.llvm.org/show_bug.cgi?id=25627#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED - constexpr value in a lambda"
href="https://bugs.llvm.org/show_bug.cgi?id=25627">bug 25627</a>
from <span class="vcard"><a class="email" href="mailto:bastienPenava@gmail.com" title="Bastien Penavayre <bastienPenava@gmail.com>"> <span class="fn">Bastien Penavayre</span></a>
</span></b>
<pre>This issue was only partially fixed.
The same code in a template context won't compile:
//works
void f0()
{
constexpr int i = 0;
[]{ return i; };
}
//error
template<class T>
void f1()
{
constexpr int i = 0;
[]{ return i; }; //i cannot be implicitly captured ...
}
godbolt link: <a href="https://godbolt.org/z/3Sc46U">https://godbolt.org/z/3Sc46U</a>
console output:
<source>:5:4: warning: expression result unused [-Wunused-value]
[]{ return i; };
^~~~~~~~~~~~~~~
<source>:13:15: error: variable 'i' cannot be implicitly captured in a lambda
with no capture-default specified
[]{ return i; };
^
<source>:12:18: note: 'i' declared here
constexpr int i = 0;
^
<source>:13:4: note: lambda expression begins here
[]{ return i; };
^
1 warning and 1 error generated.
Compiler returned: 1</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>