[clang] [LifetimeSafety] Merge lifetimebound attribute on implicit 'this' across method redeclarations (PR #172146)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 14 11:34:30 PST 2025


================
@@ -75,6 +75,18 @@ namespace usage_ok {
     r = A(1); // expected-warning {{object backing the pointer 'r' will be destroyed at the end of the full-expression}}
   }
 
+  // Test that lifetimebound on implicit 'this' is propagated across redeclarations
+  struct B {
+    int *method() [[clang::lifetimebound]];
+    int i;
+  };
+  int *B::method() { return &i; }
----------------
usx95 wrote:

Done.

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


More information about the cfe-commits mailing list