[clang] [LifetimeSafety] Fix off-by-one crash in `lifetime_capture_by` argument indexing (PR #227231)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 02:53:44 PDT 2026


================
@@ -4076,6 +4076,29 @@ void capturing_multiple_locals() {
     use(v);                         // expected-note 2 {{later used here}}
 }
 
+namespace off_by_one_crash {
+struct Item {
+  const int* ptr;
+};
+
+struct Container {
+  const Item* saved;
+};
+
+struct Helper {
----------------
usx95 wrote:

Filed https://github.com/llvm/llvm-project/issues/227246. It doesn't work right now.

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


More information about the cfe-commits mailing list