[cfe-dev] Preliminary reinterpret_cast Sema patch

Argiris Kirtzidis akyrtzi at gmail.com
Tue Oct 21 06:47:10 PDT 2008


Sebastian Redl wrote:
> Updated patch.
> Cast to self is brought in line with GCC's behavior, even though I 
> still think that it's wrong. Or maybe it's what was intended, and the 
> standard is defective.

Another point that may convince you :-) :

The quote in question, "Subject to the restrictions in this section, an 
expression may be cast to its own type using a reinterpret_cast 
operator", is a note. Notes are for clarification, they are not supposed 
to introduce new semantics. The semantics should be the same with or 
without the note.
Now consider what would happen if this note didn't exist at all. 
Wouldn't you be obliged to consider int->int as a integral->integral 
conversion and reject it as illegal ?
I think this is why "Subject to the restrictions in this section" is 
added, otherwise it would just say "An expression may be cast to its own 
type using a reinterpret_cast operator".

-Argiris



More information about the cfe-dev mailing list