[cfe-dev] GCC-specific, Clang-specific and ObjC-specific casts in C++

Eli Friedman eli.friedman at gmail.com
Sat Jul 25 11:20:50 PDT 2009

On Sat, Jul 25, 2009 at 9:04 AM, Sebastian
Redl<sebastian.redl at getdesigned.at> wrote:
> 1) Do we want to support GCC's cast-to-union in C++? I think not.

No; I think it's okay to leave that as a C-only hack.  It would
actually be difficult because it might affect SFINAE.

> 2) Should casts to ExtVector types be implicit, static_castable, or only
> reinterpret_castable? Are there formalized semantics, or should I just
> go by the CheckExtVectorCast code?

Scalar->vector splats should be implicitly legal.  static_cast should
probably work the same way for scalar->vector.  reinterpret_cast
should probably act like a bitcast.  For vector->vector, there
shouldn't be any implicit casts or static_cast; reinterpret_cast
should probably bitcast the vector.  These are all guesses, though;
note that the ExtVector semantics are supposed to be based off of

> 3) Same for Vector types.

No implicit or static casts, reinterpret_cast == bitcast, I think.
You could compare with g++, though.


More information about the cfe-dev mailing list