Closed
Description
There're four occurrences of "will eventually" in this section, for instance
[Note 1 : The seemingly equivalent expression
shared_ptr<T>(static_cast<T*>(r.get()))
will eventually
result in undefined behavior, attempting to delete the same object twice. --end note]
But what does it mean? If r.get()
compares equal to nullptr
, the program won't delete the same object twice. Moreover, in dynamic_pointer_cast
's case, the program may run "correctly" sometimes if the users handled the case when dynamic_cast
gives nullptr
...
Suggestion:
- will eventually result in undefined behavior,
+ can result in undefined behavior,
Metadata
Metadata
Assignees
Labels
No labels