| Issue |
182945
|
| Summary |
[LifetimeSafety] Detect use-after-scope through a field and member calls
|
| Labels |
false-negative,
clang:temporal-safety
|
| Assignees |
|
| Reporter |
usx95
|
```cpp
#include <iostream>
#include <string>
#include <string_view>
std::string GLOBAL = "global string";
struct S {
std::string* p_;
void bar();
void foo3() {
{
std::string stack;
p_ = &stack; // warning: participates in use-after-scope
} // destroyed here.
bar(); // later used here (via use of 'this').
p_ = &GLOBAL; // this does not save escape now.
}
};
```
This is not detected. https://godbolt.org/z/6KebzPo8K
The call to bar uses `this` which should count as a use of `p_`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs