[clang] [Lifetime Safety] Distinguish attributed/inferred lifetimebound diagnostics (PR #220248)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 09:12:48 PDT 2026


================
@@ -2299,8 +2299,8 @@ void test_optional_arrow_lifetimebound() {
   {
     std::optional<MyObj> opt;
     v = opt->getView();  // expected-warning {{local variable 'opt' does not live long enough}} \
-                         // expected-note {{expression aliases the storage of local variable 'opt' because the implicit object parameter is lifetimebound}} \
-                         // expected-note {{result of call to 'getView' aliases the storage of local variable 'opt' because the implicit object parameter is lifetimebound}}
+                         // expected-note {{expression aliases the storage of local variable 'opt' because the implicit object parameter is inferred as lifetimebound}} \
----------------
usx95 wrote:

I think this could be quite confusing and it would be great we can clarify that this is talking about `operator->` instead of `expression aliases`.
Definitely belongs to different PR.

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


More information about the cfe-commits mailing list