https://godbolt.org/z/rcPnrWrr7
#include <string>
struct S {
void setS(const std::string& s [[clang::lifetimebound]]) { this->s = &s; }
const std::string* s;
};
void foo() {
S s;
s.setS(std::string());
}
Lifetime analysis is currently not defined for parameters annotated with [[lifetimebound]] in void-returning function.
Current analysis only enforces that the annotated parameter outlives the return value. With no return value, this analysis is silently disabled.