<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63167>63167</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang fronted c++ crash when using automatic variables directly in `noexcept` of generic lambda
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MitalAshok
</td>
</tr>
</table>
<pre>
Compiler explorer link: https://godbolt.org/z/74bErMhEs
Compiling this crashes the compiler:
```c++
// clang++ -std=c++20 -fsyntax-only
struct true_type { constexpr operator bool() const { return true; } };
constexpr auto f() {
true_type i;
return [=](auto) noexcept(i) -> bool {
return true;
};
}
// static_assert(f()(0));
static_assert(requires { { f()(0) }; });
```
Some notes:
* Uncommenting the first `static_assert` makes this work.
* Removing the trailing return type `-> bool` also makes this work
* Without the capture-default `[=]`, this doesn't compile complaining that "`i` can't be implicitly captured" even though `i` isn't odr-used
* Making it a non-generic lambda (e.g., replacing the `auto` with `int`) removes the need for `[=]` and causes this not to crash.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcVE9v-ygQ_TT4MkpE8b_k4EP7S3PrZVerPf6EYRyzweCFcdvsp19hO2kSyQ4KzLz3eDMeGaM5OcSGlW-sPGRyot6H5sOQtK-x9-es9frS_PLDaCwGwO_R-oABrHFnlr9CTzRGlr8ycWTiePK69Za2PpyYOP7HxLEu2vfw0b9Hxg-Mvy6_C5xxJ6DeRFBBxh4jUI-gVqYEeZfBKr48iom39Cy7MykoK91p2YdNJM3ywxomOGy6eHEkvzfe2cuSFilMioDChL_pMiKw-g2Ud5HwewzgRwySfIDWe8vEjon9cjrHBaQpuDmZ5W_A6kN6Wf52L_cHTE7koVtRWL1GAcAdvbllp_2VIBUkP7DywMQugaR85_Fb4UhM7Ez6v2H5-6zyEfkOZZX5c_agtT48eLy4GUmSUb9ljBgS0yqeiR2fl_0t_zky4L-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