Affects Version/s: 0.10.0
Fix Version/s: 0.10.0
This overloaded assignment operator is not const-correct:
ObjectPtrT& ObjectPtrT::operator=(const T* p1);
typedef const Foo CFoo;
CFoo* p = new CFoo(some_foo);
op = p;
*op = another_foo;
assert( *p == some_foo ); // boom!
If there are cases where the const-ness needs to be removed, it should
be done explicitly by the user of ObjectPtrT, since only the user
knows if a particular case is safe or not. Doing it automatically
inside ObjectPtrT hides potentially serious errors.
I removed that assignment operator and successfully built and tested
the lib with make check, so I conclude it's not needed anyway.
If you do need to store a pointer-to-const in an ObjectPtrT you can do:
ObjectPtrT<const Foo> op;
op = p;