[libcxx-commits] [libcxx] Add [[clang::lifetimebound]] to numerous functions in libc++ include headers (PR #112751)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 28 00:37:56 PDT 2024
higher-performance wrote:
I seem to be encountering a strange situation where this code gives a dangling reference error when I annotate `std::vector::operator[]` with `[[clang::lifetimebound]]`:
```cpp
#include <string_view>
#include <vector>
std::string_view foo() {
std::vector<std::string_view> v(1);
return v[0];
}
```
This doesn't trigger if I attempt to mimic `std::vector` with my own type, which makes me think there's a bug somewhere in Clang's built-in analysis that special-cases `std::vector`...
Anybody know what is going on?
https://github.com/llvm/llvm-project/pull/112751
More information about the libcxx-commits
mailing list