Issue 152501
Summary [LifetimeSafety] Add basic a use-after-return diagnostic
Labels new issue
Assignees
Reporter usx95
    Detecting when a function returns a reference to its own stack memory.

```cpp
int* foo() {
  int a = 1;
  int* res = &a;
  return res;   // warning: returning address of local variable 'a'.
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to