<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=http://email.email.llvm.org/c/eJylVM2O2yAQfhp8Gdly7GwSH3zY3WylHlr10BcgMI5pCFDAzubtO7aTJtmN2q2KkD3A_HzDfMPGymP9FQ-w6bbOW4NpZ1pupEaZBtRNykNQW7NHE0G0KHZAWr2SGKDhOiA4G1RUPa2VgWD3CIIHDBl8jhAQ9wGiPVlao4_QWA-xJTuPAY1AsA0Eh0I1SoCwJkTfiRjg0CrRwp7vBs8RNIYAXcCm0xnL1yx_nL4vr3zvNAW1EuGgYgv46jQ3PCprWHnSYot8moIVT8McdyOSKY_Iyud4dGg4gf_OypfpdAICX47frDIR_cnT8mQMNL6z4hEcK6-2LtLFsFiAdeh5tJ6Va1asxjTfKNCdkFABKz7RhAP3RpktZfDGdtCRli7F2AhTpeBtoahEZEOXzR6e_l5X9rC-wn-d3zBUQ5BWjj4zAjDhzNwV0tYesB-wP1OB30OhomgNGwT82XE9kOHkgshCRFABNtoSOc5qYaecQ3kL4h2qYXhsCNkF0E0dzmMskdUSBvDurooDuM7snorEKdjdMGy5vt3wGDtv6H4eh_xu6XGte5FCJL4K6K2Sp7QmasWBEn8ozsRmUkuJtmT4TAb_GO6c2scCTmwgLqTpbdRrq8utaYw4Or0LahDOB787NJF1Kauy4gnvYmt9veNaGaN2tu-Tzuu6jdGFobNH-m2p5btNJuyeFlr3519KpP-BItJShdBhIOGhLGdl0ta4Wi5KvsiXOa-K5XIpxWqBOVZCzvh8UTaJ5hvUoabuYUVh6HEcXZBMrZL8PwJVF3lR5DOaeZnP51nVrJpNhatZMctnolqxeY57rnQ2-Mms3ya-Hl1SMwc61CrEcDmc2g1xBEwIo4oaa0Gv4DaNSh6HR-QDz_vte56MoOsR8S_N2dLb>53313</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy: bugprone-unhandled-self-assignment false positive
        </td>
    </tr>

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

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

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

<pre>
    New bugprone-unhandled-self-assignment check provides false positives in some cases. It seems to check only for the presence of specific constructs which makes it less useful.

Example code with explanation:
```c++
template<typename T>
struct MyPointer
{
    T* p;
    
    MyPointer& operator=(const MyPointer& other) // warning: operator=() does not handle self-assignment properly [bugprone-unhandled-self-assignment]
    {
        if (p != other.p) // however, on self-assignment p will be equal to other.p so this block will be skipped
        {
            ref(other.p);
            T* old = p;
            p  = other.p;
            deref(p);
        }
        return *this;
    }
    
    static void ref(T* ptr)
    {
        ++ptr->refCtr;
    }
    
    static void deref(T* ptr)
    {
        if (!--ptr->refCtr)
            delete ptr;
    }
};
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVM1y2yAQfhp02ZFHQrFjHXRw4nSmh3Z6yAsgWFnUGKhAdvz2XUl2bSeeNmUYaYH9-Zb92NqpY_UdD1D3G985i2lvW2GVQZUGNE0qQtAbu0MbQbYot0Bae60wQCNMQPAu6Kj3tNYWgtshSBEwzOBrhIC4CxDdydJZc4TGdRBbsuswoJUIroHgUepGS5DOhtj1MgY4tFq2sBPbwXMEgyFAH7DpzYxla5atpu_Lm9h5Q0GdQjjo2AK-eSOsiNpZVpy02CKbpmT8aZjjbkQyFRFZ8RyPHq0g8K-seJlOJyDw7fjDaRuxO3l6PBkDjVfGV-BZcbV1kS6GfAHOYyei61ixZnw5pvlOge6EhBIY_0ITDqKz2m4og3e2g45ydCnWRZgqBe8LRSUiG7psNn_6d13ZfH2F_zq_YeiGIC09fXICMOGc-SukrTvgfsD-TAX-CIWKYgzUCPirF2Ygw8kFkYWIoAPUxhE5zmphq71HdQviA6phdNgQsgugmzqcx1giZxQM4P1dFQ9wndk9FYVTsLth2OP6dqPD2HeW7mc15HdLj2vdixQi8VXC3ml1SmuiVhwo8ZfiTGwmtZRoS4bPZPCf4c6pfS7gxAbiQpreRr22utyawYij07ugBuF88OeFJqoqVFmUIok6GqwkPeZNGrU6Dm_hE13qti0lfWeqNkYfhmYwMnZDXaKvZ9LtaGHM_vxLyfNPlJGWOoQeAwnzosiLpK1Ew8t5nj8qzutS8WaxWMzny4VqFpjxvF4mRtRoQkUPjnFuqZ-OLkim15XoimecZznNrMgeHmZls2zqEpc5z7Nclkv2kOFOaDMbcMxct0m6aoRE-QY6NDrEcDmcskUcw5F_0cfWddVWGG2t3rr9PhnDVyP83zp2vTg">