<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58605>58605</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Sema::adjustMemberFunctionCC - broken if condition
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RKSimon
</td>
</tr>
</table>
<pre>
Reported here: https://pvs-studio.com/en/blog/posts/cpp/1003/ (N41)
```
void Sema::adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor,
SourceLocation Loc) {
....
CallingConv CurCC = FT->getCallConv();
CallingConv ToCC = Context.getDefaultCallingConvention(IsVariadic, !IsStatic);
if (CurCC == ToCC)
return;
....
CallingConv DefaultCC =
Context.getDefaultCallingConvention(IsVariadic, IsStatic);
if (CurCC != DefaultCC || DefaultCC == ToCC)
return;
....
}
```
The `DefaultCC == ToCC` is always false - the articles wonders if it should be `DefaultCC != ToCC` ?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVNuOmzAQ_RrzYiUCGwh54CEhjbTqTd1EfTfYgLcORr5ku3_fcUg22SrVtrWssT3DzDkHPNSav5SPYtTGCY57YQSiK9w7N1rYILKFOR7tzDrPpZ43-gAOMYCple5CUFtnYW3GEWwSxxQWjEjxJU0QWaJ4g-LV2ebxeZ6ORy053okDC0B0xfiTt-6zONTCbP3QOKmHqoJC3zxT-5dRQNF8j0iFa60VfrA7x5xsbhyV0-ar2YAF54SB3x077U0jPumGBUAMG2CN0WJ9KTCHcdlXTCk5dJUejrjypqowohu83c8Q_dAJF8IhBqSDdLq-l7fX5zQ4OfHTzSFxI1rmlbt5TAyBDhR6sN-ZkYxPShFJrsKvCBcc2YY3_8osoAS41-8QBBvhvBluyP1J4IXUxPZa4H94_zVpkgSwG-hFBfMtl3-VhRabuxdwsvseblYe30fIYywtZuqZvVjcMmUFnmEHGcyAGiUsftYDF8YGFdJh22uvOK5_LznJupREdBuJMsnzfJFkRUojXlK-pEsWOemUKFG2bhQbOpRt3m0Q4FMb_UMMgUEDZGTwR96o8m0Xd9L1vj53sFLHyzIbjX4SjYOjtNaL0MxZkcdZ1JcpadumZVmRpUlMOG2KNOWcExK3bZ4UdaRYLZQNhBEhE2e6ak24IQMHFyiIZEliQiA_S3K6IHTeQH7Bkrpmy2SR5UuUxiBSqnmgM9emi0x5Ylb7zkJQSfjFXIPMWtkN4vSaQn3mXa9N-fhxJw-g_CSiPCn4BZ0tbsI">