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

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Deducing this Lambda does not generate all the needed function calls
        </td>
    </tr>

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

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

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

<pre>
    Found when reporting #86398, so it may be related to it.
But with the following valid code, at all optimization levels, the following code does not generate correctly.
```c++
volatile int a = 0;
struct function {
 function& operator=(function const&) {
        a = 1;
        return *this;
    }
};
int main() {
    function list;
 [&list](this auto self) {
        list = function{};
 }();
}
```Clang does not generate a call to `function::operator=`, and therefor does not set `a` to 1.
Both GCC and MSVC generate the code correctly.
[Godbolt](https://godbolt.org/z/9q5zYP9Ea)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU9Fu6zYM_Rr6hbiBTNdO_OCHppkvMNwBAwYM2KNsMbE2RcokukX79YOc1OldGxgIQIo8hzyHOiV78swd1HuoD4WeZQqx-2H9P-WvxRDMa9eH2Rt8mdhj5EuIYv0JgapdU7U7oCdMAa3gWb_iwBjZaWGDkoMbUAdQj_tZ8MXKhDIxHoNz4SX3eNbOGhyD4dxFC2rnMFzEnu2bFhs8On5ml3L258pcgyZwQh8ET-w5amEcQ4w8inu94UKjrt8ItM_fEn0OTot1jNYLaoTqgAqqWzJJnEfB4-zHhQFsb4k1BNRguGTAEKE6AO3Wx2PwSYAaoPZD4e13RSpXpPd4ZJmjR6BHmWz6KQ3bw22Q7WFNZNZnbT3Q7hPOysTZJPdWWVtqllidCWcg1LMETOyOX7LNjxfC69jb_UcWC7eFwRq6s31f-5PT_vSFThrHLLUEhEatANUjVI8fN9uoxRfeZPUjH0O890osuVhDo3Kf8t1pQSb8_nSt-u2PP5_uoNlBi28-uaTefw9mCO62nUnkkjIb6oH60zW1CfEE1L8B9e2_9dtfv7e_aKC2MF1l2qrVBXfltixJNVRWxdSZmkrV7FTzwLodeKj5OBCZdqs1k9ltC9uRogdVUVXWqqrUpmVT09jsds1gWtYlPCg-a-s2zj2fM3xhU5q5y2fXFk4P7NJytURj3jMQ5QOOXX7_bZhPCR5UljHdO4gVt5z6ogzUBzywmcd8UosnfujzYPRXimW5JkbPbNjcfZZ1TMUcXfe_rVmZ5mEzhjNQn-Fvf98uMfzNowD1yzQJqF8G-i8AAP__Avxg7Q">