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

    <tr>
        <th>Summary</th>
        <td>
            `bugprone-assignment-in-if-condition` false positive when lambda is passed to call in if-clause
        </td>
    </tr>

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

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

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

<pre>
    ```cpp
#include <algorithm>
#include <vector>

static void f()
{
    std::vector<const void*> members;
    if (std::any_of(members.begin(), members.end(), [&](const void* tok2) {
        {
            const void* dotTok;
            if (tok2)
                dotTok = nullptr; // warning
            else
                dotTok = nullptr; // warning
        }
        return true;
    })) 
    {
    }
}
```

```
<source>:11:17: warning: an assignment within an 'if' condition is bug-prone [bugprone-assignment-in-if-condition]
                dotTok = nullptr; // warning
                ^
<source>:11:17: note: if it should be an assignment, move it out of the 'if' condition
<source>:11:17: note: if it is meant to be an equality check, change '=' to '=='
<source>:13:17: warning: an assignment within an 'if' condition is bug-prone [bugprone-assignment-in-if-condition]
                dotTok = nullptr; // warning
                ^
<source>:13:17: note: if it should be an assignment, move it out of the 'if' condition
<source>:13:17: note: if it is meant to be an equality check, change '=' to '=='
```
https://godbolt.org/z/xannPb43M

The warnings go away when you move the call out of the if-clause.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzdVUuPmzAQ_jXmYiUidnjkwGE32d4q9dB7ZWAAd42dYpM0_fUdO-TB7lZtpVUPtcDYM57XNx9QmvpUkDQ-X9V-T-IdiR8I41JXaqyBEr4VqjWDdF1P-NNb-gNUzgw3ZZitE05W9GBkTRvCcsI2kzp7PC8oDutqwh_wuvjYVkZbF8wIQ8UT7aEvYbCE35nJhqLLq7HQpy_GB5nOLktopZ6Csu3FxRJ0fROS5JGwlCQ7FM2CUmeeGR6is0z9eCXwY25bG_fZPM-SvYxz0pPz12o_ztaI6Y7qUam9Q0Qe0eoDXvQoBi11-9oSlIX38key3VwwgBsHTd0wwqwqf9ADiTDdyV4cmBp-WVx4ds-Tl0K-tWYcKvB04g-rlZ8ynK7p4lJoKqyVre5BO3pEakrthYRlEmmQ-Z7U0kmjqbS0HNvFfjAafMtxE9aLm4OF1AvZLK42nhLv2J2ARfL0u_K0ceCfyBLpqO3MqGpawrzWQGZzAH_EjHg31HXwRt1_Fw1B6kEglM5MIeHbKJR0J1p1UD37sFUndBtCYf0-Fp6dNmH_dkT-f7eP_9P2_SraO7Zv_jJ2zu2t_8QGjFpTl0a5pRla3P3A-7vQ-lO55h_vX-jPWNGEpqWtoeIoTvTYgaYnM57L90VXQql7EHwLlRgtLCMoVmmS52vONnFUF7ze8I2InHQK_L_qTziQxrQR-Fmke2NRgjFDBkr0ZS08YHs0htqjEBJBAl4TiMZBFS9KR46O5bIyPW6UOlwenphf8c-FW2ntCBYXSZqxTdQVWVnVWZokKx7nIlnHrC7zeNWUcR5vVjypIiVK_HIX4T_ENBxpcIFrZHAkCxYzFmcsXfF1HufLkpc5Z02yKddV06xTso6hF1ItfR6-J9FQhJQQHotKJa2zN-UZK4AQDv2L0XVmKBo5wFEcIAqxi5D7T-y0WPo">