Issue 107556
Summary [clang] Clang must diagnose the use of [[lifetimebound]] annotation in void-returning functions
Labels clang, clang:frontend
Assignees
Reporter usx95
    https://godbolt.org/z/rcPnrWrr7

```cpp
#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.


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to