Issue 108149
Summary std::unique_ptr destructor behaviour differs from (naïve?) expectations
Labels new issue
Assignees
Reporter zeule
    The unique_ptr is widely advertised as a drop-in replacement for raw pointers. In this regard, libc++ implementation of the unique_ptr destructor differs in behaviour from `delete <raw-pointer>` and what GCC and MSVC libraries do: libc++ calls reset() in the destructor, which first clears the pointer and then calls deleter. Which means that when the destructor of the contained object is executed, the link between the owner of the unique_ptr object and the contained object is broken. That is not the case for raw pointers and unique pointers from GCC and MSVC STLs.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to