Affects Version/s: 0.10.0
Fix Version/s: None
The following line of code:
void* oldPtr = ObjectPtrBase::exchange((volatile void**) &this->p, newPtr);
in the ObjectPtrT template class (objectptr.h) produces a 'dereferencing type-punned pointer will break strict aliasing rules' compiler warning.
This line can be found (with slight variances) in the destructor, operator=(const int& null), operator=(T* p1), and operator=(const ObjectPtrT& p1) functions.
This warning was produced with gcc v4.1.1 using the following compiler options:
-Wall -Wextra -Wno-unused-parameter -O3 -mtune-i686
After investigating, the warning is being caused by the first parameter.
Replacing all instances of the aforementioned code with the following makes the warning disappear:
T** pp = &this->p;
void* oldPtr = ObjectPtrBase::exchange((volatile void**) pp, newPtr);
A temporary workaround is to use the '-fno-strict-aliasing' compiler option.