On 22/05/2010 17:49, Steven Watanabe wrote:
There shouldn't be a cast through void*. Since boost::rv<T> inherits from T, it should just use a static_cast. The cast back to T is effectively a static_cast, and the two conversions need to match.
There's no conversion through void* but gcc still crashes with static_cast. C++ aliasing rules allow accesing a type T by through a base class, but we're accessing it through a non-existing derived type (rv<T>) so, I think this breaks aliasing rules. Adding __attribute__((__may_alias__)) to rv to tell the compiler that rv could alias any type seems to fix the problem (although is overkill IMHO). See: https://svn.boost.org/trac/boost/ticket/3950 Other compilers don't seem to have this problem and hopefully this emulation is temporary until all compilers implement rvalue references. Best, Ion