2010/5/23 Ion Gaztaņaga <igaztanaga@gmail.com>
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."

Yes I concur. I expected it to be undefined, but when I started looking I failed to find the relevant part of the standard.

So am I correct in stating that the move emulation is therefore fundamentally relying upon undefined behaviour with no performant alternative that uses the same interface?

Is the impact of this issue such that to be compliant we would need to use a move_sink like the adobe design? I imagine this would make substitution with proper rvalue references more difficult.

Do you have a plan, because I cannot see a simple solution despite having spent quite some time exploring the options.
 
Best,

Ion
_______________________________________________
Regards,
Neil Groves