Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-10 07:58:48


From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
> Boosters,
>
> the current implementation of shared_ptr allows the following
> program to compile with MSVC6SP5.
>
> #include <boost/shared_ptr.hpp>
> boost::shared_ptr<int> p_i;
> int main()
> {
> p_i = 42;
> return 0;
> }
>
> The line p_i = 42; generates no assembly instructions at all, it
> is simply ignored.
>
> This is especially dangerous as the compiler belives this to be
> the same as p_i = new int(0) which also doesn't generate any
> assembly instructions.

Actually, _any_ assignment works.

> I think this is a serious problem and should be addressed.

This is definitely a serious problem (with the compiler.) I don't see an
easy way to avoid the bug. Suggestions?


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