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

    <tr>
        <th>Summary</th>
        <td>
            `bugprone-unused-return-value` reported on iterator increment in loop condition
        </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>
    With `bugprone-unused-return-value.CheckFunctions` set to `::.*`.

```cpp
#include <string>

void f()
{
 std::string s;
    for (std::string::const_iterator it = s.cbegin(); it != s.cend(); ++it) {}
    for (std::string::const_iterator it = s.cbegin(); it != s.cend(); it++) {}
}
```

```
test.cpp:6:71: error: the value returned by this function should not be disregarded; neglecting it may lead to errors [bugprone-unused-return-value,-warnings-as-errors]
    6 | for (std::string::const_iterator it = s.cbegin(); it != s.cend(); ++it) {}
      | ^~~~
test.cpp:6:71: note: cast the expression to void to silence this warning
test.cpp:7:71: error: the value returned by this function should not be disregarded; neglecting it may lead to errors [bugprone-unused-return-value,-warnings-as-errors]
    7 |     for (std::string::const_iterator it = s.cbegin(); it != s.cend(); it++) {}
 | ^~~~
test.cpp:7:71: note: cast the expression to void to silence this warning
```

The result is actually used by the loop condition.

Some context on why I am trying to match all functions which might seem excessive.
This is actually something I wanted for quite a while. The idea was a bit more limited in that I wanted to find functions within test code which do not check the results. But simply enabling it in the context of the test folder actually has the same effect and actually goes a bit further.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVUGP4zYP_TXKhYjhyHGcHHxIZjbAnr8P6LGQJdpWK0upSE82l_ntheRMM9MuppeiiwJGLJsmH_keGSoiO3jEVtQnUT-v1MxjiG1vI17VC666YG7tT5ZHELuym4dLDB7Xs58JzToiz9GvX5SbsXgaUf96nr1mGzyJXQmEDBySo6iOojoWQh7FrixE-SzK4_13Vy6Xvlzub2R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