I agree with your point about instantiation. My example is just another
case that should not be checked. And it happens that this is getting done
by the same condition "has no complete definition". I added a comment
covering all of this anyways.

On Thursday, March 21, 2013, John McCall wrote:

> On Mar 20, 2013, at 4:26 PM, Alexander Zinenko 
> <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>
> wrote:
>
> Thanks for your comments and sorry that it's taking so long to polish my
> code.
> Please find the updated version attached.
>
> On 20 March 2013 07:02, John McCall <[email protected]<javascript:_e({}, 
> 'cvml', '[email protected]');>
> > wrote:
>
>> On Mar 14, 2013, at 8:47 AM, Alexander Zinenko 
>> <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>>
>> wrote:
>>
>> Thanks for review!
>>
>> I attached a quiet version of a patch that doesn't warn if any of the
>> paths is a non-virtually-derived base at offset zero.
>> During first iteration, Jordan proposed to make a separate switch to
>> enable a noisy version that warns even if the cast is safe, though. If it
>> is still required, it can be easily added back.
>> Processing multiple base paths made checking a bit heavier, but I see no
>> other approach.
>>
>>
>> +  if(!SrcRD || !SrcRD->hasDefinition())
>> +    return;
>> +
>> +  const CXXRecordDecl *DestRD = DestType->getPointeeCXXRecordDecl();
>> +
>> +  if(!DestRD || !DestRD->hasDefinition())
>> +    return;
>>
>> Please add a comment saying that we're deliberately not instantiating
>> templates here because we're not allowed to.
>>
> Actually, we do not call CheckReinterpretCast if the cast is
> type-dependent.
>
>
> I don't see your point.  Whether the cast is type-dependent has nothing to
> do
> with it.  Both arguments could be non-dependent, or we could actually be
> in a non-template context, and it'd still be illegal to instantiate the
> classes.
> For example:
>
> template <class T> class A { T val; };
> class B {};
>
> B *foo(A<void> *a) {
>   return reinterpret_cast<B*>(a);
> }
>
> John.
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to