Issue 163600
Summary Support lifetimebound calls where return type is not a pointer/view type
Labels clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
#include <iostream>
#include <string>
#include <string_view>

struct S {
 std::string_view data;
};

S getS(const std::string& s [[clang::lifetimebound]]) { return S{s}; }

void foo() {
    S s;
    {
 std::string str = "small scoped string";
        s = getS(str);
 }
    std::cout << s.data; // use-after-free
}
```
https://godbolt.org/z/9s1xqc3nW
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to