Issue 181816
Summary [LifetimeSafety] unique_ptr raw pointer errors after move
Labels clang:temporal-safety
Assignees
Reporter emaxx-google
    Getting `address of stack memory may be returned later` if `-Wlifetime-safety` is used, whenever a raw pointer is used after the `unique_ptr` has been moved - in a common coding pattern like:

```c++
class A {
 public:
  int* Foo() [[clang::lifetimebound]] {
    auto p = std::make_unique<int>();
    int* raw = p.get();
    field_ = std::move(p);
    return raw;
  }

 private:
  std::unique_ptr<int> field_;
};
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to