<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/59804>59804</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang crashes when return type of lambda is decltype
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fmun
</td>
</tr>
</table>
<pre>
`decl->value = std::visit([&](auto&& arg)->decltype(decl->value) { .... }` causes clang to crash. When replacing `decltype(decl->value)` with a concrete type (like `int`), the crash does not happen.
See https://godbolt.org/z/Tn7YTb4x9 for a demo on Compiler Explorer.
Please find attached the preprocessed source and run script.
[test-c107e8.zip](https://github.com/llvm/llvm-project/files/10338746/test-c107e8.zip)
Stack dump:
[StackDump.txt](https://github.com/llvm/llvm-project/files/10338757/StackDump.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysk01v3CwQxz_N-DKKhfH7wYckG58f6YlU9YhhvKbBYAHO26ev8HZVbaQeKvWyK9vMj98Mf0QI-myJBqgfoD5lYo-L88O87jabnPoYoGGKpLmD8ulVmJ0QyhOGqKC8h_L-VQcdgXepmjdQn4B3Yo8uPfAGhT8D71NtYsSPjYB3NzjgPUL7gHme5wjtCRqGUuyBAkoj7BmjQ-lFWHL8tpBFT5sRUtsz_hL7AzRx3nRcUKB0VnqKhGkpAu-MfqFUrm2EhqXF_BHjQpeNUDkKaF3ERWwb2RzYCdj95fd_Ilxi3EJqn4_Ax7NTkzMxd6nV8RP4-Gzb789T9d7j7DwKVLQ6dBYf3bppQx6f3jfjPPkb8n-GRCCctVUoYhRyIXVIbZ427ySFQAqD270kFFah3y0G6fUWr5z6IVKId7JgLXX5p94u5_HFV8dln3LpVuCjMa_Xv7vNux8kI_Bx1oYC8LFgZdm1VQN8_Arm_c1UopAvqPZ1S9tcZY63p33d8vge_4lK3QIfb7G3IpkaStWXvchoKJqWt03XF3W2DHzilRSqKLqyVs00VU1ZtBVVc8EkdW2R6YEzXrKClUXHirrOm2qq-7kuuqnr27KvoGK0Cm3yZJhOO9Mh7DTUfceqzIiJTDguEeeW3vD4CJynO-WHo6tpPweomNEhht-UqKOh4ZL1I38U8O2S9Lh7ewmtm9GIdVICdcBr6rPdm-GvJ3qIpZEe4j8DAAD__0FBPxU">