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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Taking an address of a function erroneously interpreted as function call.
        </td>
    </tr>

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

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

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

<pre>
    To reproduce:

```
// foo.cc

class Foo {
  public:
   void Bar() __attribute__((exclusive_locks_required(mu_)));
   void Func() {
 Bar();
   }
   mutable int mu_;
};

void acquire() {
 (&Foo::Func);
}

void foo() {
  acquire();
}
```

```
clang++ -Wthread-safety-analysis foo.cc
```

reports:

```
foo.cc:6:6: warning: calling function 'Bar' requires holding mutex 'mu_' exclusively [-Wthread-safety-analysis]
    6 |      Bar();
      |      ^
foo.cc:12:4: warning: expression result unused [-Wunused-value]
   12 |   (&Foo::Func);
 |    ^~~~~~~~~~
```

Function `Bar` is never called, because function `Func` is never called either. 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VE1z2jAQ_TXyZQfGyJaNDz5AEh97yrRHRpbWoEZYVB80XPrbO5IdPpq2HjHIaPft03vLcufUfkRsCdsS9pzx4A_Gtl-V51-CyXojL-2rAYsna2QQSIoNydOq8nnlG0I7QjsYjFkKMR0LzZ2Dzhgg9ZbkG4BT6LUSUz4AnI2SsOWW0DWhDex23Hur-uBxt0u_rfFd6ODUGXfaiDe3s_gjKIuS0PUx7Aht5lVs7xC7MIoZci58rXENJPXztDkGz3uNoEYPETIFxNNpk28SJBep7iNqeqs6Y-KFis1Utrkh3NIHYx5THwEfUu41fXwVmo97QreEbmHxzR8scrlwfEB_WfCR64tT7s6ARyCLJ2O9-6t3c06xqeYP_OR2VOM-bgXXWo17GMIovDIjEFonPWuY3XBwMFrGmGPw-B4Dkjk1XO3TFyBs-y_ShM1mQAWkfoL0fPYs2TafEvZyT3xFSbEp_2CO7yeLzkXOFl3QHsIYHMqJyrRfnLkOeCWwonOJ_3n7wYKwl18fz2fBu6teVR7vUuWgHIx4Rps0jU38BD0KHhzeqVvlqdjncEDlD2iXkMm2kE3R8AzbVV02jDXVimWHtmbYFKKkVbVm674smZD9mhVFPtBBrrHOVEtzyvJqla9oWTG25LSsJS-qoqp5KYeSlDkeudJLrc_HpbH7TDkXsF2VBaM007xH7dKcoHRuRxpHhm1jwqIPe0fKXCvn3Q3CK6_TcJky2DO88rfYLnwELmX0CMwA_CYCWmtGNMHpS_xjoj1Z9CiBu1tMFGWZBavbg_en1NhpBO2VP4R-KcyR0C5ymL8WJ2u-o_CEdulOjtBuvta5pb8DAAD__-ECejM">