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

    <tr>
        <th>Summary</th>
        <td>
            Errors in lambdas inside requires expressions should be hard errors
        </td>
    </tr>

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

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

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

<pre>
    According to [P0315r4 §2.9](https://wg21.link/P0315r4#Item.12) lambdas in `requires` expressions should behave the same as in SFINAE, i.e. _“the body of a lambda is not part of the immediate context”_. Therefore, the following should not compile:

```c++
template <class T>
concept V = requires {
    [] { T x; };
};

int main() {
    return V<void>;
}
```

Clang 17.0.1 erroneously compiles it. `V<void>` evaluates to `false` as if this would be a soft error. [Demo](https://godbolt.org/z/vEz911G3P).

The same thing in SFINAE is treated as a hard error, as it should be (see [C++20 \[temp.deduct.general\]/9](https://timsong-cpp.github.io/cppwp/n4868/temp.deduct.general#9)). [Demo](https://godbolt.org/z/Pb974xdP5).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEGPqzgM_jXuxRoUDBQ4cJi2w-pdViPt6F2fAhjIbiBsEtp579evQtudzmouK0W0iu3Pn_05ls6pYWauIDtAdtrJ1Y_GVgfTHNbB7RrT_aye29bYTs0DeoOQHV5FEmc2RTgSPOcUlZCdgIrR-8VB8gxUA9WXgeJIq_kvoPoWAJR88zxFMQGVqOXUdNKhmhH2wvLfq7LsYC-Q3xfLzikzO3SjWXWHDY_yzOhHRicnxmvcH_W3359fgI6oIo7wB7wQFALKY_AL1NH0KG-ZUDmcjcdFWh_ug4-aJu6U9IytmT2_-zvC6UeEbyNb7o3lkCB490Zrcwl9uLEKcK2ZFqU51C1OIO7fvbieFugQznbreVp0yAbJsdXSOXyD5OVqa83c8uLxO0Jywns7EPJbLCLiVaNwh2_4DskBIT9BcvP49H_7qtnjJNUMVISOf8Ky7Fc743dIjmejusDjEehzFY-gRy3nAeM8ElGMbK2Z2axO_7x3wqHyUZD0ETqoepZ6lZ7dNkV70UvtOBiClkEO5fByExslOtP7Dd5Goe4TT-arMRtM1xjtI2MHoPoXUH1--VXG8W_JK1AZPRJ_uw-PH4OG_85PGAxvWXruAheJo7TdNXVQPtDzH3OIQIVjDpyOV21JIGRHyA5B3qjjbm19NPDMVurNcAKqv3wjXk3OzMNTuyzRoPy4NpEyQHW7LJcFqJ7TYl8Evy-AKSmBwvmf7Xltyjx9716zELrrqqQrk1LuuIpzkRdFKrJsN1YN9SLmpuuStinjMu8plkXWy7ZI86wsk52qSFAqKE5FGqdxFqV9w5zvM-Y-TYgYUsGTVDrS-jyF_Dvl3MpVEe_Lcqdlw9ptS4do5gtuRiAKO8hWIeapWQcHqdDKefeB4pXXXL0EdbYd8LFGnOr44-F8uUQepHW71erqP926atCaCagOGW8_T4s1f3LrgeqNpwOqtzr-CQAA___NRpgV">