<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/125715>125715</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Error on generic lambda with trailing return type within lambda within template
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Eczbek
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/E5nrss4df

```cpp
template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
int main(){x<int>;}
```

```
<source>:1:32: error: constexpr variable 'x<int>' must be initialized by a constant expression
    1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
      | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:2:12: note: in instantiation of variable template specialization 'x<int>' requested here
 2 | int main(){x<int>;}
      |            ^
<source>:1:38: note: undefined function 'operator()<int>' cannot be used in a constant expression
    1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
      | ^
<source>:1:35: note: in call to '[] {
    [](auto) -> void {
 }(0);
}.operator()()'
    1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:1:38: note: declared here
    1 | template<class T>constexpr int x=([]{[](auto)->void{}(0);}(),0);
      | ^
<source>:2:12: warning: expression result unused [-Wunused-value]
    2 | int main(){x<int>;}
      | ^~~~~~
1 warning and 1 error generated.
Compiler returned: 1
```

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVUuPuzYQ_zTDZZQIbFjgwIHNJp-gUs8GTxK3jk39yD4O_eyVIfknzeq_anuo1kLJgB-_x4xt4b06GKIOqmeoXjIRw9G6bjt-DPR7Nlj53h1DmDzwHtgO2O5g5WB1WFt3ALb7ALbbVsZ5X8o95H16nvLlGacJ8j7QadIiEPDNqIX3-Avw7WiND_Q2OVQm4BvwF2DNwgDq50vAGhGDBdaugG_PVsnUVafvObAW-OUlxWxz_ZT3acWTUObSVT-_Ad8oE4BvL3PuOD5QTjHfeBvdSPP4vgDecwa8R3LOuhTcyJ-FU2LQhMDqOxRW4yn6gAOhMiooodUHSRzeUSyThQmYFiDvlTWQ94iIBUK9wf_dLpxbgoZqi39-2T7bk5wpZnuMTaR7VAbVIlGJoKxBu7_5dFWHfqJx9mUZ88k_R39E8oEkHslRoslmjv8kuTdFdw2q7U-S29yzj0bSXhmSuI9mvHKzEzkRrLug3hMdhTF2TnX0JJP6757jn9hQPSRxFFpjsEn-Ao4Ja1nrkQ0mOpj4XAf9nVTeQ_2yfnDx8lt_I2v-ReF_Lh1JoxburmK_iaivNu2rcEaZw3y8_ahVdOSjDhjNXNJQPa9-XeLVWehIidiC8V_25NVmyPviio_CSCyWExYPZFKdkFxD3m_saVKaHDoK0RmSiWrxcGRnsuOy5a3IqCtq3jw1dVm02bHjbGhKUVSiqBsmyj0v27JlnO8bWZNs20x1LGdVzvKyeCo5b9e5EAXVeSX2VJVt1UCZ00kovdb6fEp3Xqa8j9QVrKqLKtNiIO3nu5MxQ6849wJj6Sp1XZq0GuLBQ5lr5YO_LRNU0NRtZ8XWLKLViFqcBinwVYUjBieUTu4s2jG8TzT3KHM_TpkfBZZFpx-vaxWOcViP9gRsl9Avf6vJ2d9oDMB2M2cPbHcRde7YXwEAAP__b8hZjA">