Detect use-after-move
Open
clang:temporal-safety
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```cpp
#include
#include
struct A {
std::string data;
};
std::unique_ptr bar();
void take(std::unique_ptr in);
int main() {
std::unique_ptr a = bar();
A* pointer = a.get();
take(std::move(a));
std::cout << pointer->data; // use-after-move!
}
```
https://godbolt.org/z/sbdGGqKEx
More examples: https://godbolt.org/z/8WKsMEodo
Contributor guide
Assessment
This issue has not been assessed yet.