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

    <tr>
        <th>Summary</th>
        <td>
            Clang behaves different with other compilers for constraint nested lambdas
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:frontend,
            concepts
      </td>
    </tr>

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

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

<pre>
    Both were discovered in #133719, but the underlying causes are different from the original issue so I filed a separate one to track these.

1. The following code causes clang to crash, dating back to Clang 16 and up to trunk:

```cpp
template <class T>
constexpr auto f{[] (auto arg) {
 return [a{arg}] {
        [] () requires (a == 1) {}();
    };
}};

int main() {
 f<int>(0);
}
```

https://compiler-explorer.com/z/Tq9xzrPns

2. Clang accepts the following code, while others don't (discovered by @shafik)

```cpp

void f() {
    auto f{ 
      [](auto arg) {
 return [a = arg]() 
          requires (a == 1)
         { return a;};
 }
    };

 f(10);
}

```

https://godbolt.org/z/ncYx8q9f6

This has started since Clang 16.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVEmT8ygM_TX4ouoUBi_xwQd3Mqma2xz6MkcMcsw0ATfg9PLrp8BJL7PUl0qVbSQ9Se9JiBD02SL2pH4k9bEQa5yd7z_eLWVlW4xOvfePLs7wih5B6SDdFT0q0BYI4yXnbdkRdoBxjRBnhNUq9OZd2zNIsQYMIHLgNKFHG2Hy7pIdnddnbYUBHcKKEBz8DpM2qEBAwEV4ERGcRYgOohfyOUUF3BE6EDqUO3iaESZnjHvNyZzCe0ZphD2nOOlFmFN1SsTkNGYYB4fsUDYgrIJ12VKs9pnwYYMnDd3-clkIHSJeFpPqIfwgjQgBngj_jdBBOhsivi0exBodTKR93IgEwvb5SPgzYR0kAx3AY1y9BVI_CtI-Jlt7zN6b-fb7gkihHl9W7TFkSCD8SPgRyjtoe9zcCL8jpKP8kV4-3-mgbYSL0PYGe0s5EX7QNqZ22J5-AqXAbzRsCHOMS0gcsRNhJ-kuizboH_BtMc6j30l3Iez0Qdjp6aV7-_B_2LAFst2NciElLjHkAfipXVLpddYGwcUZfQDlLGFtTF1_G7vxHUhFwywm_ZyK_S-1CB2uTiuYfnYK8CUSfLK9cf1LtRLv2Vof76hfesH_a_TdK-W9QYrE8l0b2Mj-qV2Whu3Lf0nyC1XOTo3OxJ1LnWQtrPzzbf_STc3m_jTrALMIEKLwERUEbSV-rsSuUD1XHe9EgX3ZVryp6Z7WxdzLqqHdyBkbS95SwVRd7ys6MtbwhktaFbpnlNW0opxy1lT1Tgqxb-ppX3dStmMlSEXxIrTZGXO9pAqLvPt9yauy44URI5qQbyLG8g4TPkze2YhWEcYIOySDs3mG0kF9LHyfwB7G9RxIRY0OMXzBRx0N9ltrI87iiuHbVfSq47xNG9xnOcDk0pcN0Yu0MBZD4siIy6hEKFZv-n_wreO8jrfRT4lvj4fFu79QRsJOuclA2OnW57VnfwcAAP__dTKc2Q">