[cfe-dev] new warnings

Mike Stump mrs at apple.com
Fri Sep 26 20:28:12 PDT 2008

On Sep 26, 2008, at 5:25 PM, me22 wrote:
> On Thu, Sep 25, 2008 at 22:39, Mike Stump <mrs at apple.com> wrote:
>> class DeclGroupRef {
>>  uintptr_t ThePtr;
>>  iterator begin() {
>>    if (getKind() == DeclKind)
>>      return ThePtr ? (Decl**) &ThePtr : 0;
>> ?  You think that is safe?  Why?  I don't see any unions, I don't see
>> any memcpys, no character types.
> That's a reinterpret_cast, so my understanding is that it's legal iff
> ThePtr was originally set by a reinterpret_cast from something with
> static type Decl**.

You're focusing in on the wrong thing.  For what you're focused on,  
yes, that part is fine.  Instead, ask yourself, does he ever fetch an  
object that has a different type then the type of the stored object?   
If yes, does it fall within the rules for C++ aliasing?  See my other  
email for more details of what is wrong with the current version.

More information about the cfe-dev mailing list