[clang] [LifetimeSafety] Flow origins from lifetimebound args in `gsl::Pointer` construction (PR #189907)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 22:35:01 PDT 2026


================
@@ -2413,3 +2413,49 @@ void owner_outlives_lifetimebound_source() {
 }
 
 } // namespace track_origins_for_lifetimebound_record_type
+
+namespace gslpointer_construction_from_lifetimebound {
+// https://github.com/llvm/llvm-project/issues/175898
+struct Bar {};
+template <typename T> struct [[gsl::Pointer]] Pointer {
+  Pointer();
+  Pointer(const T &bar [[clang::lifetimebound]]);
+  Pointer(const Pointer<T> &p [[clang::lifetimebound]]);
----------------
NeKon69 wrote:

Yes that is correct. My bad here

https://github.com/llvm/llvm-project/pull/189907


More information about the cfe-commits mailing list