[clang] [LifetimeSafety] Track origins through std::function (PR #191123)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 13 22:48:56 PDT 2026
================
@@ -268,4 +268,14 @@ struct true_type {
template<class T> struct is_pointer : false_type {};
template<class T> struct is_pointer<T*> : true_type {};
template<class T> struct is_pointer<T* const> : true_type {};
+
+template<class> class function;
+template<class R, class... Args>
+class function<R(Args...)> {
+public:
+ template<class F> function(F) {}
+ template<class F> function& operator=(F) { return *this; }
----------------
usx95 wrote:
> move assign has FN. This seems an existing limitation. e.g., https://godbolt.org/z/rETxncchf
LG. In a separate PR, we can special case `std::move` to propagate inner origin list. (looks like a use-case for lifetimebound(2)).
Filed https://github.com/llvm/llvm-project/issues/191954
https://github.com/llvm/llvm-project/pull/191123
More information about the cfe-commits
mailing list