<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJytVNtyozAM_RrzokkGTGjKAw9N0j7vzPYHDAjirYNY2yTtfv3KQG6d9mnXI3yRraOjy1BS_VG8kAW_R2jIGDrprgV8V4feoEifRLwT8Xl-iCephNwEGbXYDQd4DpNYzyrg8QQi3UEs5Paq24y65E63vTvtZk_rnUg3t76dt0Pl4ee03HkafR-VGfBiE9QlkQHq0SpPlv0GkY_T63chc6iocyMUWPSD7SYMmJ7yk5Tprr8lNDNpiALqhDXphHyY6cj8bH3DSzcQLO6ccbLWW5Z77eYCAPO4JfqJz831TIMD293xvgRzruOtvYKTJS79SdkutMABnVMtgnbQYheyiDX3A-y9711oDPnC0lJdkvFLsi2f_vBX2sfSvaof9GXnzMd062iwFcfwzFBJxpNMAvrsPWzx96A5UOw8t2NvmY6mDlhK8ntwukYH1IChVlfqWmkQ2eagXbWwWA9drTq_uJqLbPd_CnE7RPY8XSaX5F0ytvwy_qgu0jpPcxWpwe_JFr06onmzH8MbHaPBmuJTlrXfD-WyogMfjDmel0Vv6ReGjnvRzg3oeJOt4iSJ9sWqKdNqhdWqqatVltRZFssmj9dV2cRlI_PIqBKNKzhdQsoOTzBC8J6TFP07A13IWAZJ48dEynyZN0myXilZPzRVmlelWMV4UNosA05ooMgWI2Q5tI4vjXbeXS8VF7DtEEfCzNBrb7DYGtW1i1ddf4SW-bbu0CjjEHpy2usjwonD-fRvADqiNaTqaAykGKP4C4nGfjw>54011</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-Tidy: misc-redundant-expression false positive with operator== overload
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pavelkryukov
</td>
</tr>
</table>
<pre>
For the following example:
```c++
enum Enum {
A = 0,
B = 1,
C,
D
};
struct Struct {
Enum value;
bool operator==( Enum x) const { return value == x; }
};
Struct foo( const Struct& value)
{
if ( value == A || value == B)
return value;
return Struct{ D};
}
```
a wrong warning message is generated: https://godbolt.org/z/br8bsTaPo
```
<source>:15:21: warning: equivalent expression on both sides of logical operator [misc-redundant-expression]
if ( value == A || value == B)
^
1 warning generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytUs1yozAMfhpz0SQDJiThwKFJ2vPObF_AYEG8dTBrm6Tdp18ZyA-d9laPMLZkffr0Uxr5UbwYC_6IUButzUW1DeC7OHUaWfrE4gOLr_s6HqVifBdk0GLbn-A5bGwzqYDWE7D0ADHj-7tuN-iSmW4_ux2mSJsDS3ePsZ23feXh9_ibRRpin4Xu8eYT1KUxGkyHVnhjKW4Qvh1fvzOeQ2VaN0CBRd_bdsSA8Sk9SYnu5ltCE5PamIA6Yo06xtcTHZ5fvR94qRqCxywYFWuzJ5lrdzcAmNYj0U98HswTDUrsMON9S-bax0d_ARdrqPUXYdswAid0TjQIykGDbagiSpoHOHrfuTAY_IWkMbI02i-Nbej2j77Sbkv3Kn6ZLydnuqZ7Z3pbUQ7PBJVktPEkoE_RwxH_9ooSxdbTOHaW6CjTAklp_BGckujA1KBNoypx7zSwbHdSrlpYlH0rResXd3eWHX6mEY-LZc-jMbkV71ax5Zf5R7JIZZ7mIvLKayz2WrTN4lXJj5D4t-yhFtohdMYpr84IF0WFmE84mDNabYSMequLT72i5325rMyJLlqfr79FZ80fDHP7opzr0dEhW8VJEh0LrBO-lnKVZBWWmHEuMqwl5luep9tNFkdalKhdQUVnnLd4gQGCzlTqSBU85kHSeJtwni_zOkk2K8Hluq7SvCrZKsaTUHoZeIQhimwxUCr7xpFRK-fd3SioDE2LOIQjfNH7o7FFJ86o3-xH_2bO0RC_GPj_B5ynaIA">