Support origin propagation for known STL types with user-defined copy/move/assignment
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
After landing #187917, origin propagation through copy/move constructors and assignment operators requires `isDefaulted()` for non-pointer-like types. For STL types like `std::unique_ptr` and `std::vector`, these operations are user-defined, so origins are not propagated.
We should consider treating known STL types as having standard propagation semantics for copy/move/assignment, even though their implementations are user-defined.
```cpp
struct S {
S();
S(const std::string &s [[clang::lifetimebound]]);
};
std::unique_ptr getUniqueS(const std::string &s [[clang::lifetimebound]]);
void owner_outlives_lifetimebound_source() {
std::unique_ptr ups;
{
std::string local;
ups = getUniqueS(local); // Move assignment breaks the propagation.
}
(void)ups; // Should warn.
}
```
cc @usx95
Contributor guide
Assessment
This issue has not been assessed yet.