Issue 184630
Summary [LifetimeSafety] False-negative with unique_ptr::reset()
Labels false-negative, clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
#include <iostream>
#include <memory>
#include <string>
#include <vector>

int main() {
    int* ptr;
    auto p = std::make_unique<int>(1);
    ptr = p.get();
    p.reset();
    std::cout << *ptr;
}
```
https://godbolt.org/z/rcTdbjT1M

It should be possible to model this as an "invalidation" if `unique_ptr::reset` is considered to be invalidating.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to