Issue |
143522
|
Summary |
[clang] Taking an address of a function erroneously interpreted as function call.
|
Labels |
clang
|
Assignees |
|
Reporter |
VitaNuo
|
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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs