-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Description
#include <iostream>
#include <memory>
struct A {
std::string data;
};
std::unique_ptr<A> bar();
void take(std::unique_ptr<A> in);
int main() {
std::unique_ptr<A> a = bar();
A* pointer = a.get();
take(std::move(a));
std::cout << pointer->data; // use-after-move!
}https://godbolt.org/z/sbdGGqKEx
More examples: https://godbolt.org/z/8WKsMEodo
frederick-vs-ja
Metadata
Metadata
Assignees
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Type
Projects
Status
No status