Issue 120853
Summary [clang-tidy] Check request: detect incorrect creating of `std::enable_shared_from_this` objects
Labels clang-tidy
Assignees
Reporter denzor200
    
```
struct A : std::enable_shared_from_this {
};
std::shared_ptr<A> a2 = std::make_shared<A>(); // OK
std::shared_ptr<A> a1(new A); // OK
auto* a3 = new A; // INCORRECT
A a; // INCORRECT
```
These two incorrect usages might contain hidden SEGFAULT.
Suppose it easily to detect by clang-tidy and might be really helpful.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to