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

    <tr>
        <th>Summary</th>
        <td>
            [clang] assertion `isDependentContext() && "cannot iterate dependent diagnostics of non-dependent context"' failed
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            c2x,
            clang:frontend,
            crash
      </td>
    </tr>

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

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

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

This crash is what I found while working on https://github.com/llvm/llvm-project/issues/57155.

```C++                
//                  |              |
//                  v              v
int(*f)(int) = [](auto t) -> decltype([] { 
    return 0; 
    } ()
){ 
    return t; 
};
```

It looks like we didn't handle the logic of lambda expressions in `decltype` and `auto` parameters.
[Lambdas in unevaluated contexts](https://en.cppreference.com/w/cpp/language/lambda#Lambdas_in_unevaluated_contexts) is a C++20 core language feature that we partially implemented. See [P0315R4](https://wg21.link/P0315R4)

Related to https://github.com/llvm/llvm-project/issues/57155 https://github.com/llvm/llvm-project/issues/45822
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVEtv4yAQ_jX4ghrZ-JH44EMeXanSHqru3isMY5sNgcjgpO2v34EkbTZbrbSqhW0G5vnNB62Vr83g_d6RfEnYNxy9la3VfmbHHqU3fO8fx8PBdG9A0g1Jl6fvz0E5KkbuBoqT48A9faCdnYxEQWmgRztulempNfQmgPLD1M6E3aGg9eHyu9uP9hcIj6JybgKHk3KeleXsOi6p0tNYE7bCQW-es1aMdLuHu_P1Xwv_tjjciCdtZTDNBWHLjrAaZ1GuKck3lJQrUm5wjU_e0rh8R_J7KkFo_7qHYBdVMPbqnG7wPIKfRkNTkl-vkjnqhUj1Jc36UzP_YYYmKNygdQ3hg6fa2q2jWm2xT0ClkoawuacDNxJb5wdAjV4Jajuq-a6VnMLLfgTnlDWOKkPR5XtBVUrRLiyFkoO45yPfgYfRXXpXrr5HP9F4MnDgeuIeJBXWeHjx7oTZn0wBMxN7DNvBCEbAmTJHfHE5sIabfuI9xGnwTlh-DvOszPNVmOf3MNgO5CunZ_qwFDMYsdyzK9oBR0ADBshoxAZL8Ypr_UrVbq9hB-hHzugPgNDpxzTPyqfis-SPPctmWpktzi9q712M3yfQEQKkyRdPyBfsi3LBWAJNVlVplWdZkSeyyWWd1zzxymtosEwR4AmU5c4B4mEjAZTbwB6MREjWJ3hPTEXCVjjwxwQ3xnqqkApYKp6Bsz5SjvfGOq-ECyQz1tx9bIqLN4aspB3H60Qm06hvb6r_g2meJkMjWAXI3ErWLYh5xkUBRVfWWSGqed1lbaJ5C9qFokP67CUmsY61RBDyZTeG9Iy82gnXYBDLTaIaljKWLjKEk5VFPqvqli9k0fEy42nZLkiRwg5LmoVUwy2bjE3Mup16h5taOe8-NhFx1RuIbQj-8YgNdmyUEfpVJLG-Jhb3GxAXuzs">