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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy 19: check bugprone-unused-return-value shows many false-positive results
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    Some change between clang 18 and 19 made clang-tidy check bugprone-unused-return-value report lots of false-positive results.

It seems the internal function matching now works differently (and incorrect).

E.g. this Qt example program shows the problem:
```c++
#include <QtCore/QString>
#include <QtWidgets/QApplication>
#include <QtGui/QFont>
#include <QtWidgets/QPushButton>

int main(int argc, char** argv)
{
 QApplication a(argc,argv);

    QPushButton quit(QString::fromUtf8("Hello World"));
    quit.resize(175,30);
 quit.setFont(QFont(QString::fromUtf8("Times"),18,QFont::Bold));
 QObject::connect(&quit,&QAbstractButton::clicked,&a,&QCoreApplication::quit);
 quit.show();
    return a.exec();
}
```

clang-tidy reports this warning:
```bash
main.cpp:13:5: warning: the value returned by this function should not be disregarded; neglecting it may lead to errors [bugprone-unused-return-value]
   13 | QObject::connect(&quit,&QAbstractButton::clicked,&a,&QCoreApplication::quit);
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

In clang 18 no such warning is emitted. And QObject::connect() is not even the target of the check. According to the [documentation of the check](https://clang.llvm.org/extra/clang-tidy/checks/bugprone/unused-return-value.html) the global system function ::connect() is meant.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVU2TozYQ_TXypcsUiLENBw7Ys072lExtUnsWUhuUERKRmvE4h_z2lMCexZudrT2kKi4KjHj9-uN1SyIE3VrEim32bPO4EiN1zlfDsyl3q8apS_XJ9Qiy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