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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] bugprone-lambda-function-name false positive
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          1aam2am1
      </td>
    </tr>
</table>

<pre>
    Hi, I'm fixing my code and using this check for wrong function name prints, but fixing this error creates false positive.

How to reproduce:
```cpp
#include <iostream>
// Type your code here, or load an example.
int bug(int num) {
    return [num](){
 std::cout << __func__ << "\n";
        return num;
 }();
}

int fixed(int num) {
    return [num, func=__func__](){
        std::cout << func << "\n";
        return num;
    }();
}

int main()
{
    bug(1);
 fixed(1);
    return 0;
}
```
Execute clang-tydy, with: 

 -checks=-*,bugprone-lambda-function-name

Result:

```
<[source>:5:22: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [bugprone-lambda-function-name]]
    5 |         std::cout << __func__ << "\n";
      |                      ^
[<source>:11:23: warning: inside a lambda, '__func__' expands to the name of the function call operator; consider capturing the name of the enclosing function explicitly [bugprone-lambda-function-name]]
   11 |     return [num, func=__func__](){
      |
```

Code execution result:
```
operator()
fixed
```

We can see that 'bug' function have a error and it is found.
But we can see that the fix in 'fixed' function, where we are capturing __func__ name inside lambda capture is also flagged, and it should not be.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVl1v8ygT_TXkZpQqhjhOLnKROK2e9_bVSntZYRjb7GKw-GiTf7_CH4lbdavquVzLsjEwh8PMnMHce9UYxCPJzyS_rHgMrXXHjPOO8i5bVVbejr8UoSX8j9Cig1pdlWmgu4GwEoEbCdGnntAqD6JF8TfU1sG7s6aBOhoRlDVgeIfQO2WCT1hVDDPSYIfOWQfCIQ_ooebaI_TWq6De8IlsLmRz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