<div dir="ltr">For the following code (wrong.cpp):<div><br></div><div><font face="monospace">bool check(bool isValid)<br>{<br>    bool retVal = false;<br><br>    if (( isValid == true ))<br>    {<br>        retVal = true;<br>    }<br><br>    return retVal;<br>}</font><br></div><div><br></div><div>when I run:</div><div>    clang-tidy -checks=modernize-use-default-member-init wrong.cpp</div><div><br></div><div>I get:</div><div>4 warnings and 1 error generated.<br>Error while processing /llvm/match/ctBad/wrong.cpp.<br>/llvm/match/ctBad/wrong.cpp:5:19: error: equality comparison with extraneous parentheses [clang-diagnostic-parentheses-equality]<br><font face="monospace">    if (( isValid == true ))<br>        ~         ^~      ~<br>                  =</font><br>/llvm/match/ctBad/wrong.cpp:5:19: note: remove extraneous parentheses around the comparison to silence this warning<br>/llvm/match/ctBad/wrong.cpp:5:19: note: use '=' to turn this equality comparison into an assignment<br></div><div><br></div><div>Note it turns the if into:</div><div><font face="monospace">    if ( isValid = true )</font></div><div><br></div><div>Seems like a very bad idea. Removing the redundant parentheses seems fine, but changing the comparison to an assignment does not. Is this a bug?</div><div><br></div><div>Thanks,</div><div>Robert</div><div><br></div></div>