<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131611>131611</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang][Windows] Microsoft mangling cannot handle lambda in decltype in return type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MagentaTreehouse
</td>
</tr>
</table>
<pre>
Given this code:
```c++
template <class>
struct B {};
struct A {
template <class T>
auto f(T) -> B<decltype([] (T) {})> {
return {};
}
};
int main() {
A{}.f(0);
}
```
Clang on Windows error:
```console
<source>(6,5): error: cannot mangle this template specialization type yet
6 | auto f(T) -> B<decltype([] (T) {})> {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 | return {};
| ~~~~~~~~~~
8 | }
| ~
```
Similar error happens on simpler code:
```c++
template <class T> // must be a function template
auto f(T) -> decltype([] {}) {
return {};
}
int main() { f(0)(); }
```
On other platforms with Itanium mangling, or if using MSVC, it can be compiled.
See https://compiler-explorer.com/z/vPz6E5ve7. (Compiler explorer seems to only have version 18 for `clang-cl`)
I can reproduce this using the main branch.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVEGPqzYQ_jXDZZQITAjkwIGwm-odVq30Vu3ZwACujI1sk9fdw_vtlcHJ7utupVZ6CCkwmRl_3zcfw60VgyIqITtD9hDxxY3alE98IOX4syEa9WIpanT3Uv4irqTQjcJiqzuCtIK4gmO83S2ws7_jytE0S-4IIa1bya2F9BHiyjqztA7PCPkZ8gdIfe5bvFrjcYUfyvF5a4CIyBensQdWPAM74Q7SRzxDWnfUSvcyE7BiY4K3lHAYO_nUcEK4DLnFqB_g-LB_iav3CIVyOHGhfPfQckutttq9BxSvZ5xD6Tthth615GpArfAPoTr9zSIZo80_NdTKakk-lNZWL6YlT50VR2B1th5Q3Qux5Uppj0wNkra53LWzM7WCS_HKndAKvTb4Qi7gPiLkNf40PW_NIHv8_h-uACK_1_3bMN7__6G8eDt21RvD8xb7_nECX8UkJDebfjjyeSZl_USsmGZJ5n-aenUlArsAu-C0WIcNIcd-Ue0meSiAuPpE5E8Evgn7zl-fiLKR_ehIvHtwDUF6xk99-KtC7UYy6MH12kwWvwk34hfHlVimzU1CDcBq1AZFj4sVasCnr7_XPiac953n2uppFpK6fZCXCEfnZuslXFUJCWZHf81SGzL7Vk_ALq_ALtffXo-P2ZXyvXdWHTLxlomWaLLoNGolX3DkV8IrGeuFTQrstUE_Hf9N7VrpybHTBuPLCs_QbHS3tOGz2Ci4kVbRsDFcteM-6sq0O6UnHlGZ5AfGkvyYFNFYxmnRU8wPTd5lh_xE1GU8S5q-74jzIjtGomQxy-I0yZOUxUmx5x31bU5Jl7CkY-wEh5gmLuReyuu012aIhLULlUmaHJMkkrwhadely9jKAhjz-9eUvmDXLIOFQyyFdfathRNOrpt63SWQPUB2DtvEG-hJtEZb3bv7DG8bYuSqk4SST03HUai7-_xz8Jh_jRYjyx9nOAg3Lk0YnEcSfnaz0X9S64BdVmYW2CWQu5bs7wAAAP__2WjfvQ">