<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/84480>84480</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] bugprone-unused-return-value false positive will matching assignment
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
HerrCai0907
</td>
</tr>
</table>
<pre>
Here's an example:
```cpp
#include <string>
class C {
public:
void setS(const char* s) {
mS = s;
}
private:
std::string mS;
};
```
```
test.cpp:6:9: 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 | mSt = s;
| ^~~~~~~
```
(No godbolt link as I could not figure out how to make the passing of the option work)
_Originally posted by @firewave in https://github.com/llvm/llvm-project/issues/84314#issuecomment-1984118735_
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVM2yszYMfRqx0ZAxNgRYsMhNvky7aRf3Ab4xIMC9xmZskzSbPnvHcH_STuduqskES3AknWPZ0ns1GqIGihcoLolcw2Rd8ws5d5aK1axMWts_YoCAlx6lQfpTzosmECdgF2Af_0e2_7pleY9woUyn154QxNkHp8wI4sczqNPSezwjlC97YFlbrbrP1IiIN6t69BRegVedNT5gN0kH_IQeeP0FxXebXxHEBT2IjxdQXt6zO3WTgf6R3oc--uK0N4jz6ycw4j7XH_T-k_PuBvLhEOmL0xHEqQZxQnLOurgIE-FN6pXQUVidoR7bB4ZJeRxW0wVlDfrJrrpHYwO2hL3yjkbpeupBvKChUVMXYo8q4CwfqEn2GOxewyMUL-06Ls4aSlezeurTvVS61QV-Tu_SGWVGn0qf7igoLl9aHBHKM34JGf6t5GbP30Dx46_NvlOJV79ZHG3fWh1QK_OG0uOv2H2SHdS4OkK7BpzsPVKa5Rttki1xQs2Idthcu2xC3a17A14_V_n5u1OjMlLrBy7Wh11fyNmgHN3ljVAZnEJYfNxufgV-HVWY1vbQ2Rn4VevbxyNdnP2DugD8qrxfyQO_VrnI8jjRMdDZeSYT0qyu8iyrSlH8fBco6RvR16KWCTVZyeqa5ccqT6ZmyDlrGeMFtXlZi6OoeTuUNQ1VPWTdUCWq4YznTLAqEyLj4tALXhWiZYVsiyEfWsgZzVLpQ2zxYN2YbL00VZ5XLNGyJe23Y8x5p6UZ06D6B3Aej7VrNl7tOnrImVY--K80QQW9XQBPsOKC380SDlJ7ijqroG6Ed6U1zjJ0U9yr_VKJCiWr083_ET2v2N8BAAD__9POaOM">