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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Requires expression incorrectly use non-static methods from generic lambda inside static method
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    Compiler Explorer: https://godbolt.org/z/4fda3ss58

```cxx
struct Foo {
 static void f(auto) requires(false) {}
    void f(int) {}

 static void g() {
        static constexpr auto b = [&](auto v) {
 return requires { f(v); };
        } (0);
        static_assert(b == false);
    }
};
```

Clang version <= 18 and other compilers accepts this program. The requires expression should be false, since `f(0)` is ill-formed in the context inside the lambda.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk9FuozoQhp_G3IwSGRuIueCiTQ4PcLT3K2Mm4F2Dsx4Tpfv0KxPStFURAmn8z_ifzx5NZIcZsWHlKytPmV7i6EPzm8aiquus8_1bc_TTxToM8N_t4nzAwOQLjDFeiMkXJlom2sH3nXdx78PARPuXibY491oSlYrxE-Mv27fi99fcbvcIxbCYCK33wA6v9xhQ1NEauHrbw5kJpZfomagh4J_FBiQm1Fk7whRLWYfTlgjwTLJz_Lr-TfmBCfWQvddIzyYyfqaIt0uAZAI6YPIEiZWoWHnavMH1c4mAcQnzu920slpKMiZfIRmSX_ZjhxMwofhd8p2Xn5oIQ2RCrS6SkQeFTxnPdj9s807-I4mj0_MAVwxk_QxMHlPNXIGee_BxxABmO3oCbQxeIkEcLcEl-CHoaQ8_Rny2mTAhrbVo9IvrocOHxSOQnQ0Cq_j50WbFwRJY53ZnHybswc4QR0zMI94i2Jlsj2vI6anr9T7rG9nXstYZNvlBHJRUQlTZ2HSlkDn2uTjXouBK1oe8VqLrTanKQqPMbCO4KHLOBZdcFtWe54p3pstFgZXulGIFx0lbt3fuOqV7nFmiBZs85wdVZk536OgxJaFJql23DMQK7ixFeuZFG906TyteVp7g_28I2dn4ENBE9wYLIcx-3m13bsI4-p7gHPwEA84YrNkIPJh8UmZLcM2XebRxXLq98RMTbXK2_XaX4H-hiUy0a3vERLt1eG3EvwAAAP__p0M40g">