[libcxx-commits] [libcxx] Add [[clang::lifetimebound]] to numerous functions in libc++ include headers (PR #112751)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 29 11:29:48 PDT 2024


================
@@ -25,4 +26,10 @@ void func() {
 #if TEST_STD_VER >= 23
   auto&& v5 = std::forward_like<int&&>(int{});               // expected-warning {{temporary bound to local reference 'v5' will be destroyed at the end of the full-expression}}
 #endif
+
+  // expected-warning at +1 {{temporary whose address is used as value of local variable 'v6' will be destroyed at the end of the full-expression}}
----------------
ldionne wrote:

If we want to move forward with the patch, we'd need coverage for all the methods we're annotating. I don't think it makes sense to do it in this file since this one is only for `std::forward` and related functions. Perhaps one test for each container we're adding it to (which would cover all the methods marked as `lifetimebound` for that container) is best.

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


More information about the libcxx-commits mailing list