Boost logo

Boost :

From: jeremy_at_[hidden]
Date: 2001-10-27 21:29:26


I'm using MSVC++ v6sp5 and I have noticed that the following compiles
without error:

--- file: test.cpp ---
#include <boost/smart_ptr.hpp>
#include <stdio.h>

void main() {
  boost::shared_ptr<int> p( new int(5) );
  p= 0;
  printf( "%x\n", p.get() );
}
----------------------

What's worse is that it prints out a non-zero number for p.get().
Obviously p.reset( 0 ) has the desired effect, which makes sense
since p's constructor is marked explicit. Assignments of the form "p=
0" appear to generate no errors, warnings or object code for all
cases where p's operator= is templated.

Is this a confirmed bug in VC++ or have I missed something dreadfully
obvious? Is there a workaround for shared_ptr?

Regards,
Jeremy Todd
iZotope, Inc.
http://www.izotope.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk