#include <vector>
struct S
{
S(const std::vector<int>& v); // missing annotation
};
S f2(const std::vector<int>& v [[clang::lifetimebound]])
{
return {v}; // actual violation location
}
S f1(const std::vector<int>& v [[clang::lifetimebound]])
{
return f2(v);
}
<source>:8:34: warning: could not verify that the return value can be lifetime bound to 'v' [-Wlifetime-safety-lifetimebound-violation]
8 | S f2(const std::vector<int>& v [[clang::lifetimebound]])
| ^~~~~~~~~~~~~~~~~~~~
https://godbolt.org/z/Wex6xaW1n
https://godbolt.org/z/Wex6xaW1n