[cfe-dev] warnings in clang
Argiris Kirtzidis
akyrtzi at gmail.com
Fri Nov 14 23:55:57 PST 2008
Sebastian Redl wrote:
> 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.
What's the difference with
D.ReadUIntPtr(reinterpret_cast<uintptr_t&>(MDC->SemanticDC),
SemaDCPtrID);
The type-punned pointer is never dereferenced either.
More information about the cfe-dev
mailing list