Issue 172013
Summary False-negative for 'this' param annotated in declaration but in definition
Labels clang:temporal-safety
Assignees
Reporter usx95
    https://godbolt.org/z/GerTP67dc

```cpp
#include <string>
#include <string_view>

struct S {
    std::string_view x() const [[clang::lifetimebound]];
    std::string i;
};

std::string_view S::x() const { return i; }

void G() {
    std::string_view x;
    {
 S s;
        x = s.x(); // No error. Bad.
    }
 (void)x;
}

std::string_view LB(std::string_view in [[clang::lifetimebound]]);

std::string_view LB(std::string_view in) { return in; }

void foo() {
    std::string_view x;
    {
 std::string s;
        x = s; // error! Good.
    }
    (void)x;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to