https://bugs.llvm.org/show_bug.cgi?id=43826
Bug ID: 43826
Summary: Thread Safety Analysis: false positive on const auto
scoped_lock variable
Product: clang
Version: 9.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
$ cat main.cpp
#include <mutex>
static std::mutex guard;
int main() { const auto lock = std::scoped_lock{guard}; }
$ clang++ -std=c++17 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wthread-safety
main.cpp
main.cpp:5:57: warning: releasing mutex 'lock' that was not held
[-Wthread-safety-analysis]
int main() { const auto lock = std::scoped_lock{guard}; }
^
1 warning generated.
when the variable is "auto lock" instead of "const auto lock", then no warning
is generated.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs