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

    <tr>
        <th>Summary</th>
        <td>
            lambda with `this auto` that captures `this` in a member function is not an integral constant expression
        </td>
    </tr>

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

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

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

<pre>
    https://godbolt.org/z/azqxac8xE
```cpp
struct S { 
  int i = 42;
  constexpr auto f() { 
    return [this](this auto) { 
      return this->i;
    }(); 
  }; 
};

static_assert(S().f() == 42);
```
Clang rejects the above code with:

```
<source>:10:15: error: static assertion expression is not an integral constant expression
   10 | static_assert(S().f() == 42);
      |               ^~~~~~~~~~~~~
<source>:5:14: note: use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function
    5 |       return this->i;
      | ^
```
If we remove `this auto` then [compile fine](https://godbolt.org/z/Gb8qE7Whh), the two should be equivalent right?
Not really sure what the standards say about this.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVE1zIjcQ_TXNpcvUIM0HHOZgG0jlksseckz1SA2jREhYH8beQ357SjNezJKtJJUpCn2-Vr_XT6IYzdEx99A8QbNdUE6jD_3IF2PtH4vB6_d-TOkcQT6C2IPYH70evE1LH44g9l9B7Onryxup9dsOqi1Uj9BW80-dz_NMTCGrhF8QuiecpxCNS2gQ5BZrAfLp27TyLiZ-OweknDweQKxBbL5DIgZOOTiE5imNJkKzBbEuvQnz9-1XQNnzAHJnbg5EhG47nwLyE1Umr8N58NH_oETJqN8oRg4JxPrLHGF5zVduP6hNYe-UmYfPltwRA__OKkVMIyMN_pVRec14MWksmt-ceQcH-Rx9DopB7kA-rqry14B8RA7Bh9KZs8Q5S-MdFmE5xtI1EZ1PSK5Ugo-B7Kw9uXSz7arSqkLonvF_8Z5rUODff9Ds_rz5fkirEFrVhYzziUubI6M_IIhuKr7o8OwLhVAoeWffkaz1F9aThsZNyvIr2UyTBv6AhIqsxeSRSpyr50qwE58GDnjITqVbAbC5YfCPfpqpQnN_H-bhzwe8MAY-lVJDW336tq1KqpOtlT-djWU8GMezvf_tEv40rF923a_jWIQXzxPpdPEYR5-txoGRX7J5JcsuYTDHMYHczxn94hMGJmvfMebAeBkpTfhiBk1BR4z0XsyZ00R5OeMWupd6Ize04H7VVZ1cteumW4x93dSNVpJoo7qOlFRab9qOaikGErw-LEwvKlFXoupWdV017bIVdat117SVllIoDXXFJzJ2ae3rqbBcmBgz9-tqs-kWlga2cXqyhHB8wWkRhCgvWOgL5mHIxwh1ZU1M8TNKMslyb-k0aJrs8YMKUEJF55QDx2-rZcE4pHtz_MdLtMjB3r-iJo15WCp_ArEv6X00D-fgy3sAYj-RiiD2E-m_AgAA__8SULHN">