Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-02-04 11:40:10


Jaroslav Gresula wrote:
> When I run the weak_ptr_test (a part of the regression tests) on HP-UX
> (aCC version HP ANSI C++ B3910B A.03.35) I'm getting a lot of
> failures. The reason is that IMHO the weak_ptr_test.cpp relies on a
> non-portable construct.
>
> There is copy_assignment() template function which takes shared_ptr<>
> by value. All caller sites of this function pass on an unnamed
> shared_ptr<> temporary. The first line of copy_assignment() checks if
> shared_ptr<>::unique() is true for the passed object.
>
> This test succeeds for all compilers we use in our shop but for the
> aCC. The reason is that upon entering copy_assignment()
> shared_ptr::use_count() is equal 2 as the compiler creates a temporary
> on the caller site and copy-ctor is used to pass on the object to
> copy_assignment() which seems to be in concert with the C++ standard
> [12.2]. Is my observation correct?

You are absolutely right. Fixed in CVS.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net