Issue 167290
Summary [LifetimeSafety] False-positive when paths are moved to a longer-lived storage
Labels false-positive, clang:temporal-safety
Assignees
Reporter usx95
    ```cpp
#include <stdint.h>

#include <span>
#include <utility>
#include <vector>

void foo() {
    std::vector<int> src_data;
    std::span<int> src_span;
 {
        std::vector<int> temp_src_data = {1, 2, 3};
 temp_src_data.push_back(12);

        src_span = temp_src_data;
// ^~~~~~~~~~~~~

        src_data = std::move(temp_src_data);
 }
//  ^ destroyed here

    (void)src_span[0];
//        ^~~~~~~~ note: later used here
}
```
https://godbolt.org/z/74WzPPnT1
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to