Mir

Comment 4 for bug 1183507

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

"About the shared pointer now, I think if the shared pointer points to the base class we will have problem (because the destructor that will be called is chosen at compile time for the virtual functions) but if it points to the subclass we are fine."

Either you're saying something irrelevant, or you've misunderstood something. To clarify what do you expect the output of this to be?

#include <memory>
#include <iostream>

struct example { ~example() { std::cout << "No problem\n"; } };

int main()
{
    std::shared_ptr<void> pointer_to_void = std::make_shared<example>();
}