Issue 175273
Summary [LifetimeSafety] Warning for get() on stored unique_ptr
Labels new issue
Assignees
Reporter emaxx-google
    ```c++
#include <memory>
#include <utility>
#include <vector>

std::vector<std::unique_ptr<int>> storage;

int *f() {
    auto up = std::make_unique<int>(1);
    auto* p = up.get();
    storage.push_back(std::move(up));
    return p;
}
```

The warning `address of stack memory is returned later` seen on trunk but not on Clang 21 (https://godbolt.org/z/c1frxaezW).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to