<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55087>55087</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Lambdas with capture as default value of a lambda's parameter
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++,
clang:frontend,
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
cor3ntin
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
cor3ntin
</td>
</tr>
</table>
<pre>
Clang fails to reject that code that should all-most certainly be ill-formed
```cpp
void f() {
[](auto a, int = [=] { return a; }()) {};
}
```
GCC, ICC, MSVC reject that code
https://godbolt.org/z/sdxEPdo6c
Cf https://eel.is/c++draft/expr.prim.lambda#capture-9 for the standardeese
For reference, clang reject that scenario if the outer context is a function rather than a lambda
```cpp
void f(int a, int = [=] { return a; }()) {}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydU02P2yAQ_TX4MlrLwfHaOfiwSbpVpVaqVKl3DENChcECvB_99R3sRLvpXqpa2MwHDO_NM4NXr_3BCncCLYyNkDwE_IUyQTqLBNIrXK149rNVIKy9G32kDIYkjLOvMCAYimofRlSsOrLq4fK9r9Yhp2mNPHmjQDPeMb4D1u7XKNDDmj1rjpQRM0EQjB8AjEvA6uOSq4-UzlsIXpqDoyX1nvzjWuxaj_z6UjXbtzBW9_PhkKt_WadvP34ePjJ-z-Kc0hRZ_cD4I42TV4O3qfThRN5veqN6-fRd-Xv5ftNBw-0-RFuaSIZkfE9DBaFTjr9MoZyCGUsrxkER8VqKiRji3Q6opQQKISbhlAgKMd5ie6QFATUGdBIzHblI-Z5PlOhEMB6MXmr5OWEgli7hSwITQYCenUzGOwiCVuQjBfUXLoD-TdCs1aLa_4l2W75Qfa129U4UySSL_dcFSYRnk85waQ-Qr1CL2SZ4EnYmZvoNNG8jTCKIEYltMQfb_yUjVZqHUvqRHGufrtPdFHzuHbkmxhmzYk1TdW1x7jd1191LrLXcaKWbVouN4EPFh3arhqqThRUD2thn5pxfdCYrdyUHsjQEQIfce6feMg6fYTkth5pjYXpecV5tecN5023bshNb3HGUm1Zqvhl2bFvhSNe1zJDzr1iEfkE_zKdISWtiim9JEaM5OcQrMh9ql4y7nEYX7uxDf40WC5J-If0HiME8hA">