[cfe-dev] warnings in clang

Sebastian Redl sebastian.redl at getdesigned.at
Fri Nov 14 15:36:19 PST 2008


Argiris Kirtzidis wrote:
> Here's a similar case, doesn't gcc has a problem with this ?
>
>   template <typename T>
>   void ReadPtr(T*& PtrRef, const SerializedPtrID& PtrID,
>                bool AllowBackpatch = true) {
>     ReadUIntPtr(reinterpret_cast<uintptr_t&>(PtrRef), PtrID, 
> AllowBackpatch);
>   }
>   
It's a trick to avoid GCC's warning. Because the function takes a 
reference and passes a reference on, the type-punned "pointer" 
(reference, actually) is never "dereferenced" (accessed). The actual 
ReadUIntPtr accesses it, but by then GCC has forgotten the original type.

Sebastian



More information about the cfe-dev mailing list