std::auto_ptr
crashes on assignment with VC8.0#include <memory> class X { public: double d_; }; std::auto_ptr<X> px = new X; // shouldn't compile at all
px
is accessed or destructed. Reason: During the assignment new X
is implicitly converted to an auto_ptr_ref which accecpts a void*
in its constructor. But std::auto_ptr_ref
expects a std::auto_ptr<X>**
instead of a X*
. So, treating X*
like it was a std::auto_ptr<X>**
is unlikely to yield pretty results.There is a related discussion on comp.lang.c++. There is also a related discussion in a MSDN-forum but it's more noise than signal.