On 23/05/2010 11:15, Neil Groves wrote:
I convinced myself that with static_casts do not break strict aliasing rules since the conversion from rv<T>* to T* is valid. I believe that section 5.2.9 para 2 applies:
The problem is not downcasting, but the fact that T is not rv<T> (the
dynamic type of T is T, not rv<T>):
"If the object of type “cv1 B” is actually a subobject of an object of
type D, the result refers to the enclosing object of type D. Otherwise,
the result of the cast is undefined."
When we use static_cast