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

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 21 08:34:45 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}}
----------------
Xazax-hun wrote:

Do we need the 'the' in this diagnostic message? English is not my native language but it feels a bit unusual to me. 

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


More information about the cfe-commits mailing list