Issue 163597
Summary Detect use-after-move
Labels clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
#include <iostream>
#include <memory>

struct A {
    std::string data;
};

std::unique_ptr<A> bar();

void take(std::unique_ptr<A> in);

int main() {
    std::unique_ptr<A> a = bar();
    A* pointer = a.get();
    take(std::move(a));
    std::cout << pointer->data; // use-after-move!
}
```
https://godbolt.org/z/sbdGGqKEx
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to