[clang] [clang] Lifetimebound in assignment operator should work for non-gsl annotated types. (PR #113180)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 22 05:05:13 PDT 2024


================
@@ -330,8 +330,8 @@ struct StatusOr {
 };
 
 void test(StatusOr<FooView> foo1, StatusOr<NonAnnotatedFooView> foo2) {
-  foo1 = Foo(); // expected-warning {{object backing the pointer foo1 will be destroyed at the end}}
-  // No warning on non-gsl annotated types.
-  foo2 = NonAnnotatedFoo();
+  foo1 = Foo(); // expected-warning {{object backing the foo1 will be destroyed at the end}}
+  // This warning is triggered by the lifetimebound annotation, regardless of whether the class type is annotated with GSL.
+  foo2 = NonAnnotatedFoo(); // expected-warning {{object backing the foo2 will be destroyed at the end}}
----------------
hokein wrote:

Removed the extra `the`.

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


More information about the cfe-commits mailing list