Issue 120543
Summary Diagnose dangling issues on member field access
Labels clang:diagnostics, clang:memory-safety
Assignees
Reporter hokein
    We have some supports in member field access for references (#81589). It would be good to diagnose on the view types, see https://godbolt.org/z/zbx8hPera

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

struct S2 {
  std::string s2;
};
struct Q3 {
  const S2* get() const [[clang::lifetimebound]];
};
void test() {
  auto& t = Q3().get()->s2; //dangling, clang diagnoses it.
  std::string_view v = Q3().get()->s2; // dangling, clang doesn't diagnose it, bad.
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to