[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
Fri Nov 1 10:49:35 PDT 2024


================
@@ -10,6 +10,8 @@
 #ifndef SUPPORT_TEST_MACROS_HPP
 #define SUPPORT_TEST_MACROS_HPP
 
+#pragma clang diagnostic warning "-Wdangling"
----------------
ldionne wrote:

Was it that part in `libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp`:

```c++
    std::span<const int> s5 = {{1,2}};
#if TEST_STD_VER >= 26
    std::span<const int, 2> s6({1, 2});
#else
    std::span<const int, 2> s6 = {{1,2}};
#endif
    assert(s5.size() == 2);  // and it dangles
    assert(s6.size() == 2);  // and it dangles
```

I don't understand how that would trigger `-Wdangling` after this patch though?


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


More information about the libcxx-commits mailing list