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.