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

    <tr>
        <th>Summary</th>
        <td>
            `bugprone-unused-return-value` warns about stream insertion operator (`operator<<`)
        </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>
    If you enable the check to warn about all unused returns values  by setting `bugprone-unused-return-value.CheckFunctions` `::.*` it will also report the unchecked usage of `operator<<`.

The following are all common code which is regularly unchecked. So I think it might sense to not warn about these.

```
#include <iostream>

void f()
{
std::cout << "str";
}
```

```
#include <sstream>

void f()
{
std::ostringstream oss;
oss << "str";
}
```

```
#include <fstream>

void f()
{
std::ofstream of("file");
of << "str";
}
```

It should still be reported for the extraction operator as it might indicate actual issues:

```
#include <sstream>

void f()
{
std::istringstream iss("str");
double d;
iss >> d;
}
```
In this case the extraction fails and you need to check the result. See https://godbolt.org/z/KzPor3hMK.

That could be a dedicated check though and this check could just ignore both of them.

CC @HerrCai0907
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VduK4zgQ_Rr5pYhR5CSOH_zQne6wzbCwMPsDslW2NaNIQVXqbM_XL7LTV2YYaBgwuRRVqlOnjo41kR09Yiu2t2J7V-jEU4jtYCNe9CMWXTBP7cMATyEBet05BJ4Q-gn778ABLjp60F1IDNo5SD4RGojIKXqCR-0SEkD3BITM1o8gdrJL4zkGj6sle7Vkr-bk8pBPPibfsw2exE7mClHdiOqmFOomByzDxToH2lGAiOcQeQaV_AwLDSTSI0IYcm04Y9QcoqgO-dnJUsg7IW-Wz38nhCE4Fy4ZnI44j9GH0yl46INBuEy2n8ASRByT09E9vTYq4WuAB-DJ-u8Z1smOEwOhJ8zk-MBvCeIJCd91z6Mtz_JXVdb3LhkEUR1sII6oT6K6f1vzGKyBQai9UM01Xt8uP4jNwlSf2y0Dg1CKOAqlRHX7nH_38_a_x0SfhpSHsX5c6iEQvcAJRH8E6_B5rMMzzCVRDdZhRqWaV9TDZ0E_MNAUkjNAnGXc4VXEaGAIcZYy_sdRz1cAnvULml4lZr2xvWYE3XPSDixRQsro__wm7btNWqKFoysHbygyIWW_MC8BO2_6XlT3b4K_IuvB53tF0GvCj5wM2joC7c3sSx7R5Ot2NaUp80nJcQlfEWFiPs_MqKNQxzGYLjguQxyFOv4Q6vjlxz8hVtPfXz74gmbo5y11CBoMLoSbly4hjdMMYUE5R5eCb4kY7OhDROgCT9mIeMLTuwaHA4iN_AtjPGgrG1kXpq1MUzW6wHZdr2Wj6qZqiqmtNWppmr3Zd3Jb97uqw9rguus7ua43cihsq6TayEpJ2Wy2VVMO-3pdb7qd6rem328GsZF40taVzj2e8ujFrJd2v23WVeF0h47mF4BSHi-LmPIut3dFbHPNqksjiY10lpheT2HLDtvfOHp27GyCdHXBZ914wvhe4FlHP_FroZoiRdd-WKTlKXVlH05CHTOi69fqHMM37Fmo4_VSqOM85_8BAAD__1ZQFIc">